/    Sign up×
Bounties /Pin to ProfileBookmark

getting errors on vercel deployment

  im facing a issue in deployment to vercel i have a webapp and both of its backend and frontend links are here im facing the issue of status 404 when /products route is hit by the api from the frontend but when i run this app on localhost it works just fine i have tried everything possible but im still getting the same error i dont know what to do. link to backend – https://github.com/vckymann/backend link to frontend – https://github.com/vckymann/Stealth i would be very thankful if u guys can help me out.
  
at first i was getting the CORS error although i was already using cors in the backend so to solve it i had to create a specific vercel.json file but once i created it the CORS error was solved and this new status 404 came

to post a answer
Back-endExpressJSFull-stack DeveloperNode.jsReactWeb Hosting

2 Replies

Davinci•003 auto-replyWhen you encounter errors during a Vercel deployment, it's important to diagnose the issue systematically. Here are some steps and tips to help you troubleshoot and resolve common deployment errors on Vercel:

### 1. Check the Build Logs
The first step is to check the deployment logs in your Vercel dashboard. These logs can provide specific error messages that are crucial for diagnosing the problem. Look for any error messages or warnings that could indicate what went wrong during the deployment process.

### 2. Common Deployment Errors

#### Incorrect Build Commands
Ensure that your package.json file contains the correct build commands. For a typical Node.js project, your scripts section might look something like this:

``json
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
}
`

#### Dependencies Not Installed
If your project is missing dependencies or has incompatible versions, the deployment will fail. Make sure all necessary dependencies are listed in your
package.json file and try running npm install or yarn locally to ensure everything installs correctly.

#### Environment Variables
If your application relies on environment variables, ensure they are correctly set up in the Vercel project settings. Missing or incorrect environment variables can lead to deployment failures or runtime errors.

#### Unsupported Node.js Version
Vercel supports specific Node.js versions. If your project uses a version not supported by Vercel, it may fail to deploy. You can specify a Node.js version in your
package.json file like so:

`json
"engines": {
"node": "14.x"
}
`

### 3. Local Build Test
Before deploying, try building your project locally using the same build command specified in your
package.json. This can help catch errors early. For a Next.js project, you would run:

`bash
npm run build
`

or

`bash
yarn build
``

### 4. Check for Large Files
Vercel has limits on the size of serverless functions and overall project size. If your project exceeds these limits, it may fail to deploy. Consider optimizing large assets or splitting your project into smaller parts if necessary.

### 5. Contact Support
If you've gone through these steps and still can't resolve the issue, consider reaching out to Vercel support. Provide them with details about your project and the errors you're encountering for more specific assistance.

By following these steps, you should be able to diagnose and fix most errors encountered during Vercel deployment. Remember, the deployment logs are your best friend when it comes to understanding what went wrong.

Was this helpful?

Copy linkTweet thisAlerts:
@OKEAMAHMay 25.2024 — When you encounter errors during a Vercel deployment, it's important to diagnose the issue systematically.
×

Success!

Help @vckymann spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 10.12,
social: @webDeveloperHQ,
});

legal: ({
terms: of use,
privacy: policy
analytics: Fullres
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @aldoushuxley,
tipped: article
amount: 1000 SATS,

tipper: Anonymous,
tipped: article
amount: 1000 SATS,

tipper: @linalla,
tipped: article
amount: 1000 SATS,
)...