-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Errors with ky / globalThis.fetch when trying to upgrade @sentry/nextjs > 7.29.0: typeerror, cannot read properties of undefined (reading 'bind') #7070
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
Comments
Hi, thanks for writing in. I dug around in the Ky.js code and can't really make a connection to the Sentry SDK causing this error. As far as I am aware we also didn't change anything between 7.29.0 and 7.36.0 that might trigger this error. Can you try deleting your node_modules and reinstalling with the newest versions of the packages? Also, could you create a reproduction example we can use to debug this and also raise an issue with the Ky team? They might know better what's going on here. |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
@lforst : still have this error with sentry
Yes done, but changed nothing.
Will try, but not that easy. 👉 What is sure is that is related to this line in Ky and that worked up to sentry fetch: options.fetch ?? globalThis.fetch.bind(globalThis), 💡 By reading the CHANGELOG, this is one of the following PR that broke things:
|
@shouze Are you using the |
No I don't think, not explicitly in any cases. Here's my // This file configures the initialization of Sentry on the browser.
// The config you add here will be used whenever a page is visited.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from "@sentry/nextjs";
const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
const SENTRY_ENVIRONMENT = process.env.IBE_ENV;
Sentry.init({
enabled: SENTRY_ENVIRONMENT !== "development",
dsn:
SENTRY_DSN ||
"https://[email protected]/5840525",
// Adjust this value in production, or use tracesSampler for greater control
integrations: [new Sentry.Replay()],
tracesSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
// ...
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
// that it will also get attached to your source maps
environment: SENTRY_ENVIRONMENT || "unknown",
ignoreErrors: [
"TypeError: Failed to fetch",
"TypeError: Load failed",
"TypeError: NetworkError when attempting to fetch resource.",
"ResizeObserver loop limit exceeded",
"ResizeObserver loop completed with undelivered notifications.",
],
}); And the server one: // This file configures the initialization of Sentry on the server.
// The config you add here will be used whenever the server handles a request.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from "@sentry/nextjs";
const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
const SENTRY_ENVIRONMENT = process.env.IBE_ENV;
Sentry.init({
enabled: SENTRY_ENVIRONMENT !== "development",
dsn:
SENTRY_DSN ||
"https://[email protected]/5840525",
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1.0,
// ...
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
// that it will also get attached to your source maps
environment: SENTRY_ENVIRONMENT || "unknown",
});
|
I don't think we changed anything in particular that should cause this error. Maybe it's a timing issue: Before 7.30.0 Sentry ran after ky construction and now it runs before? In any case, I would recommend raising an issue in the ky repository itself, maybe they know what's going on. I currently don't know what causes this and how to fix this. We need a reproduction example. |
Yes, this is also something I spotted when reading changes. Can be related indeed.
I try to reproduce on a minimal nextjs project quickly. In the mean time you're right, I'll open an issue on ky repository later today. |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
@shouze I suffer from two errors in my SPA: "TypeError: Failed to fetch" and "TypeError: NetworkError when attempting to fetch resource." I noticed that you added those in the ignore list. Could you explain what are those errors? It seems to happen rarely on my app for requests to the server, and I'm crashing the whole UI. |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/nextjs
SDK Version
7.36.0
Framework Version
nextjs 13.1.6
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
yarn run test
Produces such errors when (using ky
0.33.2
):Was working up to version
7.29.0
of@sentry/nextjs
. Any upgrade generate such errors.Using nodejs 16.x at the moment.
Expected Result
No errors, like with SDK <=
7.29.0
Actual Result
The text was updated successfully, but these errors were encountered: