Serverless function crashes in deploying express app built with typescript #11567
Replies: 1 comment
-
It seems like you're encountering a common issue with deploying serverless functions on Vercel when using TypeScript. The error message suggests that the module 'auth.controller' is missing from the 'dependencies' in your package.json. This could be due to several reasons, such as the file not being included in the build output, or the path specified in the require statement is incorrect. Here are a few steps you can take to troubleshoot and resolve the issue:
Additionally, it's important to configure your Express Serverless Function correctly for Vercel. There are guides available on using standalone Express with Vercel that could provide further insights https://github.com/orgs/vercel/discussions/1140. Also, checking the deployment logs on Vercel can give you more information on what might be going wrong https://stackoverflow.com/questions/76322158/why-does-my-node-js-express-app-crash-with-this-serverless-function-has-crashed. If you've already tried these steps and are still facing issues, it might be helpful to look at similar cases where others have encountered and resolved similar deployment problems https://stackoverflow.com/questions/76887764/vercel-deploy-serverless-function-has-crashed https://dev.to/tirthpatel/deploy-node-ts-express-typescript-on-vercel-284h. Feel free to share any additional details or error logs, and I'll do my best to assist you further. |
Beta Was this translation helpful? Give feedback.
-
Question
Summary
For deploying, followed the step of building and pushing the build folder to repo using github action to another branch, I have deployed that specific branch, but it gives error on starting the server, which crashes the serverless function
Error:
Able to run it locally on deployment branch using
node app.js
, but crashes on deployment.Feel free to ask follow up question to resolve the issue.
Thanks in Advance!
Example
https://daystream-server.vercel.app/
Steps to Reproduce
Create a node.js and typescript based project, add below github actions to build and deploy this project to another branch of same repo:
Deploy this branch in vercel with below vercel.json
Beta Was this translation helpful? Give feedback.
All reactions