-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@sentry/nextjs not reporting issues i serverless functions #3643
Comments
Hey, thank you for reporting. Could you share your next config with us? Also, is this happening during local development, or when deployed on something like Vercel? |
Sure, The contents on my next.config.js is below... const { withSentryConfig } = require("@sentry/nextjs");
const withImages = require("next-images");
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
const webpack = require("webpack");
const withPlugins = require("next-compose-plugins");
const withTM = require("next-transpile-modules")(["@medv/finder"]);
const basePath = "";
const nextConfig = {
basePath,
productionBrowserSourceMaps: true,
images: {
domains: ["x", "y", "z"],
},
webpack(config, options) {
config.module.rules.push({
test: /\.ejs$/,
use: {
loader: "ejs-compiled-loader",
options: {
htmlmin: true,
htmlminOptions: {
removeComments: true,
},
},
},
});
config.module.rules.push({
test: /\.worker\.js$/,
use: { loader: "worker-loader" },
});
config.plugins.push(
new webpack.ProvidePlugin({
_: "underscore",
})
);
config.plugins.push(
new options.webpack.DefinePlugin({
"process.env.NEXT_IS_SERVER": JSON.stringify(
options.isServer.toString()
),
})
);
return config;
},
async redirects() {
return [
{
source: "/",
destination: `${process.env.API_URL}/`,
permanent: true,
},
{
source: "/blog",
destination: `${process.env.API_URL}/blog`,
permanent: true,
},
{
source: "/blog/:slug*",
destination: `${process.env.API_URL}/blog/:slug*`,
permanent: true,
},
{
source: "/changelog",
destination: "/changelog/page/1",
permanent: true,
},
];
}
};
const SentryWebpackPluginOptions = {};
// Make sure adding Sentry options is the last code to run before exporting, to
// ensure that your source maps include changes from all other Webpack plugins
module.exports = withPlugins(
[
withBundleAnalyzer,
withImages,
withTM,
[withSentryConfig, SentryWebpackPluginOptions],
],
nextConfig
); This happens when deployed to vercel, though it doesn't report errors locally either (is it supposed to?). |
same issue here, any luck? |
No, I've not managed to get it working yet |
|
For context: we had this issue when we first manually integrated Sentry with Vercel (before the Next.js plugin). The issue, as I remember, is that Sentry queues up exceptions to be sent to the server but Vercel terminates the function instantaneously — causing the exception to be lost. Adding |
@DavidChouinard interesting, having no issues with error logging for serverless Vercel functions in |
For me, all serverless endpoints are broken when wrapping them with Reverting to 6.4.1 didn't change anything. |
Yeah I have this running on a few projects hosted on Vercel and the server side error are never reported |
@ThePaulMcBride Maybe this comment might give you some direction. #3691 (comment) I only fixed this issue myself yesterday, it's under-documented, unfortunately. |
I would have thought that this would be handled in the That way the serverless function wouldn't be terminated before the error is reported. I wonder if it would be possible to make it work like that? |
About a month ago a change was made to the
It seems like the |
Possibly related issue |
Hey everyone, thanks for all the comments and feedback. We are currently working on a patch to fix these issues (and some of the linked issues) by changing how we do server side initialisation of the Sentry SDK - we hope to push something out ASAP. |
Is it still recommended to use |
Not sure what kind of help this is but a current temporary solution I am using is to manually check for client and call
Not exactly understanding what init does, I dont know the the real performance hit I am taking with this manual hack but it appears to be adding around ~100ms delay @Gomah the experimental flag seemed to have not effect for me. |
@AbhiPrasad any update? |
Hey. The release in |
@AbhiPrasad How bad are these flushing issues? Do you have a timeline as to when these issues will be resolved? I think getting some issues reported is better than none, but flushing issues still seems like a huge concern to me. |
We have a fix on the way for the flushing issues, but no timeline at the moment. Will update this issue as soon as that is merged and released. |
@AbhiPrasad will this flushing change help with issues raised during e.g. |
@Gomah It might depend on the hosting service you use and maybe also on the nextjs features (you use). I have to use this flag on netlify for my project to work. |
Hi, all. The flush issue should be fixed in #3811. Once we release that fix (hopefully in the next day or two, as v6.10.0), please give it a try and let us know if you're still having issues. |
Reverted to 6.4.1 which seems to fix the issue while we wait on 6.10.0 |
Has anybody been able to confirm 6.10.0/6.11.0 fixes the error? On 6.11.0 and it works correctly locally but doesn't log any exceptions when deployed to Vercel |
Hi @DavidChouinard @lobsterkatie 6.11.0 wasn't working for me, I just had to downgrade to 6.4.1 to get reporting from Vercel API endpoints. Since this issue is closed I created a new issue #3917 with my specific experience, but please feel free to close that as a duplicate if it's better to re-open this issue. |
@lobsterkatie @AbhiPrasad any idea why the sdk still fails to capture exceptions in Vercel with 6.11.0? Happy to setup a minimal demonstration |
Hey we are investigating, thanks for letting us know about your issues. |
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)Version:
Description
I've recently started using the
@sentry/nextjs
package for a Nextjs site. I've followed through with the installation guide with one exception. I'm using environment variables instead of the file generated by the wizard. On the client side it works great, the releases and bugs are being tracked, but I'm getting no reports from my serveless functions when they throw errors.This is the serverless function I am testing and nothing is showing up in my Sentry dashboard when it fails.
The text was updated successfully, but these errors were encountered: