Search code examples
javascriptreactjsvercelastrojs

Astro project on Vercel deployment


Title: Error when deploying Astro project on Vercel: "500: INTERNAL_SERVER_ERROR - Code: FUNCTION_INVOCATION_FAILED"

Issue Description: When attempting to deploy my Astro project on Vercel, the deployment process completes successfully, but I encounter the following error:

500: INTERNAL_SERVER_ERROR Code: FUNCTION_INVOCATION_FAILED This issue is accompanied by the following log information:

Time: October 06 12:22:41.74 GMT+02:00 Request Path: / Status Code: 500 Host: 7sb8p-1696587762095-ea66c95e5111 Request User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Level: Error Environment: preview Branch: v04 Cache: MISS Type: Serverless Function Function: /render Runtime: Node.js 18.x Execution Duration / Limit: 241ms / 10s Memory Used / Limit: 19 MB / 1024 MB In addition, the following module not found error is reported in the logs:

plaintext Copy code Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/dist/entry.mjs' imported from /var/task/___vc/__launcher/__launcher.js at new NodeError (node:internal/errors:405:5) at finalizeResolution (node:internal/modules/esm/resolve:329:11) at moduleResolve (node:internal/modules/esm/resolve:992:10) ...

I have also tried creating a new project with the same src folder, but the issue persists during deployment on Vercel. Previous versions of the project worked without any problems.

Can someone please help me identify and resolve the "FUNCTION_INVOCATION_FAILED" error and the module not found issue during the deployment of my Astro project on Vercel?


Solution

  • I had the same problem as you. I resolved deleting the .vercel folder when I checked the build in local. I deleted that folder and then put the folder on the .gitignore file.

    After that, Vercel rebuild the project and it works.

    I hope it helps you.