-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Next.js docs for v8.0.0 #12044
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
Hey, sorry about that - we are jumping on this as we speak. in the meantime, to unblock you, can you create a file export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('./sentry.server.config');
}
if (process.env.NEXT_RUNTIME === 'edge') {
await import('./sentry.edge.config');
}
} as outlined here |
@dorin-flooz Thanks for pointing this out! I updated the docs so they are in line with v8. I guess the warning won't go away if you import the files like in the snippet @HazAT suggested. You have to delete the export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
Sentry.init({
dsn: env.DSN
tracesSampleRate: 1.0,
});
}
if (process.env.NEXT_RUNTIME === 'edge') {
Sentry.init({
dsn: env.DSN
tracesSampleRate: 1.0,
});
}
} |
hey @HazAT / @s1gr1d, thanks for the quick reply! What about versioned docs - any plans to have that implemented? |
@dorin-flooz we discussed this internally and probably going to work on them |
the doc concerning "telemetry" is still missing, no? Thanks for the hints |
Hello @kbsali, do you mean this section: https://docs.sentry.io/platforms/javascript/guides/astro/sourcemaps/#disabeling-telemetry-data-collection |
@s1gr1d this is specific to Astro/vite apparently, we are running a nextjs project |
@kbsali I am not 100% sure if we are talking about the same thing. You are right, it is currently not directly documented when the Next.js docs talk about extending the configuration. However, Astro and Next.js both |
as far as I can tell
I see options for |
Oh yes, Next.js is using webpack, but the options are the same. The options specifically for the webpack plugin are defined here. And the docs show you how to configure your build options (the link I posted in my previous comment). I think, what you want to achieve is this in your export default withSentryConfig(nextConfig, {
// your other options...
telemetry: false
}); Is this helping you? If yes, we will add this to the docs. |
関連してそう getsentry/sentry-javascript#12044 あとedgeは必要無いので削除。ビルドwarnが出なければそのままでヨシ
Adding the following to next.config.js solved my issue. Don't see this mentioned on the installation page but it is on the migrate from 7 to 8 docs experimental: { |
Thanks @briantweed, this will be added to the "Manual Setup" docs as well: getsentry/sentry-docs#11140 |
I pasted this part in my next.config.js file
|
* chore: onSuccess 제거 * refactor: 불필요한 h-full 제거 * chore: onSuccess 제거 * fix: sentry 설정을 instrumentation에서 수행 ref : getsentry/sentry-javascript#12044 * feat: GTM 추가 ref : https://nextjs.org/docs/app/building-your-application/optimizing/third-party-libraries * refactor: 불필요한 속성 및 컴포넌트 제거 * docs: 주석으로 코드에 대한 설명 추가 * refactor: InitSentryUserInfo 컴포넌트 이동 * feat: eslint-plugin-unused-imports 설치 및 세팅 * refactor: 네이밍 앞에 -Memo-` prefix로 통일 * refactor: Header를 주로 사용하는 측인 layout/[lng]에 위치 * refactor: 불필요한 파일 제거 * refactor: 불필요한 함수 래퍼 제거 및 변수명 수정 * refactor: handleRequestAppend 함수 분리 * refactor: `groupKey` 기본값 설정 * refactor: 불필요한 단언문(!) 제거 * chore: sentry의 silent옵션 제거 * refactor: `ExtensionDialog` 이동 * fix: 확장 프로그램이 설치된 경우에만 가이드 실행 * refactor: ExtensionInstallCheckDialog 분리 * feat: ExtensionInstallCheckDialog 동적 import * refactor: 기명 함수로 수정 * chore: placeholder 시간 최소화 * refactor: 변수명, 함수명을 직관적으로 수정 * refactor: queries와 mutations 분리 * feat: 공통 훅을 shared폴더로 묶기 * refactor: 순서 변경 * refactor: 불필요한 훅 제거 * refactor: `useKeyboardBind`를 isMetaKey도 받을 수 있도록 확장 * fix: 메타키 이슈 해결 * chore: type import * refactor: 사용하지 않는 타입 제거 * refactor: 컨벤션에 맞는 폴더로 이동 * refactor: 폴더 구조 컨벤션에 맞게 수정 * refactor: 불필요한 컴포넌트 depth 제거 * refactor: Header를 공통 컴포넌트로 이동 * refactor: container에서 section 네이밍으로 통일 * refactor: 컴포넌트 파일을 재 역할에 맞는 폴더로 이동 * refactor: server.ts와 client.ts에 `util`을 앞에 붙여주기 * refactor: 불필요한 import 및 컴포넌트 제거 * chore: type imports eslint rules 추가 * style: type import eslint 적용 * chore: web의 eslintl 제거 * fix: eslint-import-resolver-typescript로 eslint typescript resolve ref : import-js/eslint-plugin-import#2969 (comment) * fix: fix the lint * fix: 잘못된 import경로 수정
@HazAT, What you are saying here matches the docs, but it appears these sentry.*.config files are not compatible with NextJS 15, at least with Turbopack. |
Hello, please check this issue regarding Turbopack support: #8105 You can add your Sentry server configuration in If something does not work with this setup please open a new issue describing your problem as this is not connected to this issue title anymore. |
Thank you, @s1gr1d, are there docs on good Sentry defaults to use for instrumentation.ts and intrumentation-client.ts? I have my instrumentation.ts set up like this so far: import * as Sentry from "@sentry/nextjs";
const dsn = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
export function register() {
switch (process.env.NEXT_RUNTIME) {
case "nodejs":
Sentry.init({ dsn, sendDefaultPii: true });
break;
case "edge":
Sentry.init({ dsn, sendDefaultPii: true });
break;
}
}
export const onRequestError = Sentry.captureRequestError; Is this a good starting point? How would my instrumentation-client.ts file differ? |
You can find all the information about setting up the |
Hi @s1gr1d, I have referred to those docs several times, but they do not seem to cover my use case, which is Turbopack for development + Webpack for production + Pages router. I believe I need two files: instrumentation.ts and instrumentation-client.ts. (And note that I get errors if I try include a sentry.server.config.ts or sentry.edge.config.ts file.) From the NextJS docs, it looks like I am not supposed to export a From the Sentry docs, it looks like there are two different event handlers ( If the above is correct, a basic setup would look like this: instrumentation.ts: import * as Sentry from "@sentry/nextjs";
const dsn = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
export function register() {
Sentry.init({ dsn, sendDefaultPii: true });
/* for custom setup for Node vs. Edge, use this:
switch (process.env.NEXT_RUNTIME) {
case "nodejs":
case "edge":
}
*/
} instrumentation-client.ts: import * as Sentry from "@sentry/nextjs";
const dsn = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
Sentry.init({ dsn, sendDefaultPii: true });
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart; Does this seem correct? |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
8.0.0
Framework Version
React latest
Link to Sentry event
No response
SDK Setup
No response
Steps to Reproduce
After upgrading to
@sentry/nextjs 8.0.0
, we get the following message in ouryarn next build
log:We tried following the documentation at https://docs.sentry.io/platforms/javascript/guides/nextjs to fix these issues, but it seems to be out of sync:
sentrySDKOptions
options.telemetry
telemetry
sentry.server.config.ts
- https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/integrations/#integration-usage-in-nextjsExpected Result
Actual Result
...
The text was updated successfully, but these errors were encountered: