The config you wrote allowed me to pass the problem of the public directory.
However I'm using graphql and I have the following error when browsing the app:
/var/task/src/main.js
2023-01-10T17:26:08.853Z baf32391-0925-4f77-b503-ea1ba0c55cee ERROR Did you forget to add it to "dependencies" in package.json?
RequestId: baf32391-0925-4f77-b503-ea1ba0c55cee Error: Runtime exited with error: exit status 1
Runtime.ExitError`
Any ideas how to solve this? The Vercel documentation mentions some potential issues around case, bug my imports are correct with gql.type and when I look into the source folder that is deployed, the fil is present at the correct location.
I fixed it by reverting to relative imports over everything.In your code you had an
like import {} from src/common.gql.type. Changing it to import {} from ../common.gql.type would probably work.
This Serverless Function has crashed. Your connection is working correctly. Vercel is working correctly. 500: INTERNAL_SERVER_ERROR Code: FUNCTION_INVOCATION_FAILED ID: bom1::sgk4v-1711014022883-1e9ed54f4c37
The workaround I did was to make sure all my imports were not using aliases.
I found out from my vercel logs.
Cannot find module 'src/common'
Require stack:
/var/task/api/src/modules/users/users.service.js
/var/task/api/src/modules/users/users.module.js
/var/task/api/src/app.module.js
/var/task/api/src/main.js
Did you forget to add it to "dependencies" in package.json?
Node.js process exited with exit status: 1. The logs above can help with debugging the issue.
INIT_REPORT Init Duration: 1138.81 ms Phase: invoke Status: error Error Type: Runtime.ExitError
So I changed src/common to its actual path. eg .../.../.../common, and everything worked.
It appears vercel is unable to properly handle import aliases, particularly with NestJS. I guess you have to do some extra hacking to make it work, else you have to avoid path aliases.
Thanks for this post. If you don't mind, can you do one post on how to deploy a NestJS application which is inside an Nx monorepository that already has a NextJS app or ReactJS app.
This Serverless Function has crashed. Your connection is working correctly. Vercel is working correctly. 500: INTERNAL_SERVER_ERROR Code: FUNCTION_INVOCATION_FAILED ID: bom1::sgk4v-1711014022883-1e9ed54f4c37
I had some issues when I deployed my Nest App on Vercel, i made a collection of the issues and wrote it down. Mainly for myself to remember when I need it again for another project, but it might also be helpful for others: nerd-corner.com/lessons-learned-hosting-nestjs-app-on-vercel/
Thank you! i just want to ask you to put the OPTIONS method on your vercel.json file. if it is not there, the browser cannot make preflight requests, so you cannot make json requests and etc
Nice article.
The config you wrote allowed me to pass the problem of the public directory.
However I'm using graphql and I have the following error when browsing the app:
`2023-01-10T17:26:08.853Z baf32391-0925-4f77-b503-ea1ba0c55cee ERROR Cannot find module 'src/common/gql.type'
Require stack:
package.json? RequestId: baf32391-0925-4f77-b503-ea1ba0c55cee Error: Runtime exited with error: exit status 1 Runtime.ExitError`Any ideas how to solve this? The Vercel documentation mentions some potential issues around case, bug my imports are correct with gql.type and when I look into the source folder that is deployed, the fil is present at the correct location.
Cheers,
Nicolas
Did you find a way of fixing this? I'm getting a similar error
No, I finally used Azure
I fixed it by reverting to relative imports over everything.In your code you had an
like
import {} from src/common.gql.type. Changing it toimport {} from ../common.gql.typewould probably work.I wrote this article using Vercel CLI.
todayunboxed.com/deploy-your-nestj...
Anyone can check this out!
For those having this error,
This Serverless Function has crashed. Your connection is working correctly. Vercel is working correctly. 500: INTERNAL_SERVER_ERROR Code: FUNCTION_INVOCATION_FAILED ID: bom1::sgk4v-1711014022883-1e9ed54f4c37The workaround I did was to make sure all my imports were not using aliases.
I found out from my vercel logs.
So I changed
src/commonto its actual path. eg.../.../.../common, and everything worked.It appears vercel is unable to properly handle import aliases, particularly with NestJS. I guess you have to do some extra hacking to make it work, else you have to avoid path aliases.
Thanks for this post. If you don't mind, can you do one post on how to deploy a NestJS application which is inside an Nx monorepository that already has a NextJS app or ReactJS app.
Hi! Did you find how to do it?
This Serverless Function has crashed. Your connection is working correctly. Vercel is working correctly. 500: INTERNAL_SERVER_ERROR Code: FUNCTION_INVOCATION_FAILED ID: bom1::sgk4v-1711014022883-1e9ed54f4c37Hey did you find any solution for this?
I had some issues when I deployed my Nest App on Vercel, i made a collection of the issues and wrote it down. Mainly for myself to remember when I need it again for another project, but it might also be helpful for others: nerd-corner.com/lessons-learned-hosting-nestjs-app-on-vercel/
pls, help me
Any fix to the bug
Thank you! i just want to ask you to put the OPTIONS method on your vercel.json file. if it is not there, the browser cannot make preflight requests, so you cannot make json requests and etc
Does anyone know how to deploy socket.io service on vercel?
how to connect to database mr?