#api routes not working in production

1 messages · Page 1 of 1 (latest)

deep meadowBOT
#

Hi @indigo hemlock. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the provided extracts, I cannot pinpoint the exact issue with your serverless function. However, I can provide some general troubleshooting steps to help you identify the problem.

  1. Check the application logs: You can find the application logs at the host URL under the /_logs path. For example:
https://my-deployment-my-username.vercel.app/_logs

Source: Vercel Application Error Codes (https://vercel.com/docs/errors/application-error-codes)

  1. Ensure your dependencies are installed correctly and compatible with your Next.js version.

  2. Make sure your serverless function is not reaching the timeout threshold (https://vercel.com/docs/concepts/limits/overview#serverless-function-execution-timeout) in production.

  3. Customize the 500 page (https://nextjs.org/docs/pages/building-your-application/routing/custom-error#500-page) to provide a better user experience when an unhandled exception occurs.

  4. Consider using an error tracking tool like Sentry to log and track exceptions. There's a Sentry integration for Vercel (https://vercel.com/integrations/sentry?utm_source=next-site&utm_medium=docs&utm_campaign=next-website) and a Next.js example with Sentry (https://github.com/vercel/next.js/tree/canary/examples/with-sentry).

Source: Next.js Production Checklist (https://nextjs.org/docs/pages/building-your-application/deploying/production-checklist)

If you still face issues, I recommend checking the official Next.js and Vercel documentation for more information.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

Vercel Documentation

This section focuses on errors that can happen at the level of your application when you interact with Vercel.

Unlock commits, releases, and sourcemaps

Vercel Documentation

This reference covers a list of all the limits and limitations that apply on Vercel.

Override and extend the built-in Error page to handle custom errors.

#

@indigo hemlock kapa.ai is still learning and improving, please let us how it did by reacting below