-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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
Improve @next/plugin-sentry support and expose additional to plugin hooks #18272
Conversation
* TODO(kamil): Unify SDK configuration options. | ||
* Workaround for callbacks, integrations and any unserializable config options. | ||
**/ | ||
exports.serverConfig = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The runtime configuration approach is not needed if you compile the configuration values into the bundle (prefixing using NEXT_PUBLIC_
. However keep in mind that we shouldn't do that for the getRelease
part given it will cause every single build to invalidate the webpack cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but there's no way to provide additional configuration to Sentry.init
without that approach, as NEXT_PUBLIC_
supports only serializable values.
const { serverRuntimeConfig = {}, publicRuntimeConfig = {} } = | ||
getConfig() || {} | ||
const runtimeConfig = | ||
serverRuntimeConfig.sentry || publicRuntimeConfig.sentry || {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next/config
should not be used. This is not compatible with Next.js' SSG mode and only exists for legacy reasons.
const { publicRuntimeConfig = {} } = getConfig() || {} | ||
const runtimeConfig = publicRuntimeConfig.sentry || {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next/config
should not be used. This is not compatible with Next.js' SSG mode and only exists for legacy reasons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Timer What do you suggest to replace it?
const { serverRuntimeConfig = {}, publicRuntimeConfig = {} } = | ||
getConfig() || {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next/config
should not be used. This is not compatible with Next.js' SSG mode and only exists for legacy reasons.
serverRuntimeConfig: { | ||
sentry: { | ||
type: 'server', | ||
}, | ||
}, | ||
// Sentry.init config for client-side code (and fallback for server-side) | ||
// can accept only serializeable values. For more granular control see below. | ||
publicRuntimeConfig: { | ||
sentry: { | ||
type: 'client', | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved to your own sentry.config.js
file or similar.
"SENTRY_DSN", | ||
"SENTRY_RELEASE" | ||
] | ||
"required-env": [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there no longer any required envs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the PR description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should fix the bug with the key please instead of bypassing it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree. This PR is the effect of PoC work, and it was necessary to go around this limitation for demo purposes.
@Mike-Koech reported your account as spammer. |
required-env
is currently removed, as it doesn't respectNEXT_PUBLIC_
presence, so despite providingNEXT_PUBLIC_SENTRY_DSN
it would still complain that it's not there, unless{ env: { NEXT_PUBLIC_SENTRY_DSN } }
would be manually provided innext.config.js
.