[Next@12.0.0] API route 500'ing in production, works locally
See original GitHub issueWhat version of Next.js are you using?
12.0.0
What version of Node.js are you using?
14.18.0
What browser are you using?
Firefox
What operating system are you using?
Windows
How are you deploying your application?
Vercel
Describe the Bug
I have a few api routes, and one of them is failing in production builds, but works fine locally. They work fine in previous stable version of next, 11.1.x.
Uncaught (in promise) Error: An error has occured: 500
e useReviews.ts:32
l runtime.js:63
_invoke runtime.js:293
S runtime.js:118
Babel 6
w useReviews.ts:21
c useReviews.ts:59
Ii React
unstable_runWithPriority scheduler.production.min.js:18
React 3
D scheduler.production.min.js:16
onmessage scheduler.production.min.js:12
60053 scheduler.production.min.js:12
Webpack 16
Expected Behavior
The API route should not 500 since it works locally.
To Reproduce
I am not exactly sure how to reproduce, but I am using an API route to fetch from a third-party API and return some json.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
API route works locally but not in production #8383 - GitHub
A clear and concise description of what the bug is. To Reproduce. Steps to reproduce the behavior, please provide code snippets or a...
Read more >Nextjs api route internal error in production - Stack Overflow
All apis are working just fine when serving locally but when i try to deploy the app in vercel/ heroku, the apis give...
Read more >API Routes: Introduction - Next.js
API routes provide a solution to build your API with Next.js. Any file inside the folder pages/api is mapped to /api/* and will...
Read more >How to use Next.js API Routes? - Refine Dev
We will deep dive into Next.js API Routes with Dynamic Routes. ... Next.js is a React framework and platform for building production-grade, ......
Read more >Environment Variables in Next.js - Frontend Digest
For local development, you need a file called .env.local which contains all environment variables available for API routes and your server. To make...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, this has been updated in
v12.0.2-canary.11
of Next.js, please update and give it a try!Note: this still isn’t compatible with
@sentry/nextjs
so if that needs to be usedoutputFileTracing: false
can be set in yournext.config.js
@ijjk ah! Good catch. I don’t think we are getting much use from Sentry on these low-level API routes so I think I’ll just remove it.