Adam Bartholomew
Adam Bartholomew

Reputation: 1

Function Invocation Error in Vercel Flask app deployment

So I recently refactored my Flask application so that everything is not in one giant app.py file: models, routes, config, etc. After doing this it runs fine locally, but when I push everything to GitHub, Vercel tries to build the serverless function from my most recent push and the build succeeds but I get an Internal Server Error when I go to my url. I'm unsure if the issue is with my vercel.json file calling the wrong src/dest or if a package I'm using is not supported by Vercel (though I'm using the same Python version that Vercel uses so that shouldn't be a problem).

The source code is in my GitHub (https://github.com/adam-bartholomew/encode-message).

Has anyone seen a problem like this and know where I can begin debugging?

Images:

Vercel Runtime Logs

Vercel Internal Server Error

I tried changing my vercel.json file a few times based on what Vercel has on it's website but that didn't correct the issue, it actually caused the build to fail.

Upvotes: 0

Views: 915

Answers (2)

Arteev Raina
Arteev Raina

Reputation: 21

You need to run the vercel application in a development mode using the following command in order to know where you flask application crashes.

vercel dev

After this you doing this you will get to know which file / module / package is actually causing the crash and you should be able to fix it.

For me, the issue was related to Flask version that I was using so I had to downgrade my flask version to a lower major version.

More information over here - https://github.com/orgs/vercel/discussions/2217#discussioncomment-7563760

Upvotes: 0

Adam Bartholomew
Adam Bartholomew

Reputation: 1

I solved my own problem; there was a mistake in one of the environment variables set up on Vercel. I corrected the environment variables and my next build succeeded.

The SQLAlchemy connection uri is supposed to begin as "postgresql:...". My environment variable that holds this was set to the default that Vercel creates which begins as "postgre:...".

Upvotes: 0

Related Questions