You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No matter what I do, my endpoints are all hanging with a vercel 504 error. Sometimes they come through, but rarely. It's only on /api/* routes as all my pages load, though I'm not doing any get* methods on them. When I completely remove Sentry from my codebase, everything is extremely fast and there are no errors whatsoever. It works running next dev locally, but only fails like this when deployed to vercel. All my environment variables are fine.
Steps to Reproduce
No matter what I do, my endpoints are all hanging with a vercel 504 error. Sometimes they come through, but rarely. It's only on /api/* routes as all my pages load, though I'm not doing any get* methods on them.
Sorry, I had to rip out my Sentry integration to have a working site, so a repro would be a lift. I just followed the docs for integration Sentry/Next/Sentry with the tunneling and then had a /api/health-error that all it would do is throw an error. Instead of being a 500, it would hang for 10s+ and give a 504. All my other api routes were hanging with a 504 (including some successful ones). Even a /api/health endpoint that just returned a json blob would take a very long time. Once I took out Sentry, all these problems vanished.
I am just wondering if the flow call is correct here.
It should resemble this, am I right?
withSentryConfig(
withBundleAnalyzer({ /* Next.js config /}),
{ / Sentry options */ }
)
I think this would be the correct way of doing this:
module.exports = flow(
withBundleAnalyzer({
enabled: process.env.ANALYZE === "true",
}),
config => withSentryConfig(config, {
/* Sentry options */
})
)(config);
Maybe try to create the config without currying it. withSentryConfig is not an unary function and needs the Next.js config and the Sentry options, while withBundleAnalyzer is a unary function. But in your code snippet, you were adding them to flow in a similar way.
See how I'm importing it as withSentryConfigRaw and redefining withSentryConfig to essentially be exactly what you're saying. If you were right, then I'd be having a lot more issues, ie all the other props wouldn't be doing their jobs, but they are. Regardless, I had tried what you're suggesting to no effect.
My guess is that you have some other package that is not a nice citizen. In those cases we would need a repro cause otherwise it becomes a guessing game. If you can share relevant code that would be great, otherwise there's not much we can do right now. :/
Activity
[-]Vercel 504'[/-][+]Vercel 504 on all API routes[/+]s1gr1d commentedon Feb 4, 2025
Hello, thanks for writing in. Can you please provide a minimal reproduction example?
saiichihashimoto commentedon Feb 5, 2025
Sorry, I had to rip out my Sentry integration to have a working site, so a repro would be a lift. I just followed the docs for integration Sentry/Next/Sentry with the tunneling and then had a
/api/health-errorthat all it would do is throw an error. Instead of being a500, it would hang for 10s+ and give a 504. All my other api routes were hanging with a 504 (including some successful ones). Even a/api/healthendpoint that just returned a json blob would take a very long time. Once I took out Sentry, all these problems vanished.chargome commentedon Feb 5, 2025
@saiichihashimoto could you maybe share your next config file in the state that caused the issue?
saiichihashimoto commentedon Feb 5, 2025
10 remaining items
chargome commentedon Feb 7, 2025
Another thing: found an old issue with
next-superjson-plugin– this might also be the culprit.saiichihashimoto commentedon Feb 12, 2025
See how I'm importing it as
withSentryConfigRawand redefiningwithSentryConfigto essentially be exactly what you're saying. If you were right, then I'd be having a lot more issues, ie all the other props wouldn't be doing their jobs, but they are. Regardless, I had tried what you're suggesting to no effect.saiichihashimoto commentedon Feb 12, 2025
It MIGHT be, but none of my errors resemble the errors I'm seeing here, so I'm not inclined to believe that's what's happening.
lforst commentedon Feb 13, 2025
My guess is that you have some other package that is not a nice citizen. In those cases we would need a repro cause otherwise it becomes a guessing game. If you can share relevant code that would be great, otherwise there's not much we can do right now. :/
saiichihashimoto commentedon Mar 10, 2025
It does seem like it was another issue. I couldn't find where it was, but it seemed to be triggered only when sentry was also involved 🤷