-
-
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 cant upload sourcemaps in default next.js project #13270
Comments
Assigning to @getsentry/support for routing ⏲️ |
Hi, could you please paste your build output logs? Thanks for the reproduction repo, we'll take a look. |
Full build logs:
Machine: win10
Yes token is saved in
Soo sentry can reach token. |
hey @GorlikItsMe, we had another look at this and it looks like it's an issue with how we use |
I have a same problem with sourcemaps, before nextJS I used a only @sentry/webpack-plugin and it works, In documentation is that @sentry/nextjs has this lbb under the hood. So I dont know where the problem is :-( |
@Merynek are you on Windows too? |
Now I tried to run build using WSL |
Yes!, but on CI/CD is linux so, mby its not the system problem |
@Merynek do you have a reproduction repo for that? |
I was following along with the workshop today and I've been running into the same issue with the same error messages. My setup is practically the same (see below). I've confirmed that the
next.config.mjsimport { withSentryConfig } from '@sentry/nextjs';
/** @type {import('next').NextConfig} */
const nextConfig = {
async redirects() {
return [
{
source: "/",
destination: "/manage",
permanent: true,
},
];
},
};
export default withSentryConfig(
nextConfig,
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options
org: "my-org",
project: "sentry-workshop",
authToken: process.env.SENTRY_AUTH_TOKEN,
// Only print logs for uploading source maps in CI
silent: false,
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
// Automatically annotate React components to show their full name in breadcrumbs and session replay
reactComponentAnnotation: {
enabled: true,
},
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
tunnelRoute: "/monitoring",
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
}
); sentry.client.config.ts// This file configures the initialization of Sentry on the client.
// The config you add here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from '@sentry/nextjs';
Sentry.init({
dsn: 'https://[email protected]/xxx',
// Add optional integrations for additional features
integrations: [
Sentry.replayIntegration(),
Sentry.feedbackIntegration({
colorScheme: 'system',
}),
],
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
tracesSampleRate: 1,
// Define how likely Replay events are sampled.
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// Define how likely Replay events are sampled when an error occurs.
replaysOnErrorSampleRate: 1.0,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
}); EDIT: I ran this entire setup through WSL (Ubuntu 22.04) a moment ago and the sourcemaps upload successfully and the client code is viewable as intended, so, at least for me, this seems to be related to #13288. |
@dually8 thanks for providing more info. I'll take a look at fixing this for windows. |
Currently, we use `path.join` to provide sourcemap directories. On Windows, the resulting strings would use `\` which is an escape character for glob patterns and thus no sourcemaps would be found. This fix ensures we use posix paths which glob then handles correctly on Windows too. Closes: #13270 Partly fixes: #13288
Currently, we use `path.join` to provide sourcemap directories. On Windows, the resulting strings would use `\` which is an escape character for glob patterns and thus no sourcemaps would be found. This fix ensures we use posix paths which glob then handles correctly on Windows too. Closes: #13270 Partly fixes: #13288
Tested latest version (8.37.1) and everything works. 🚀 |
Environment
SaaS (https://sentry.io/)
What are you trying to accomplish?
I want to add sentry to my next.js project
How are you getting stuck?
For some reason sentry cant upload sourcemaps during build time. Because of that, you cant see the source code in the sentry dashboard.
I created example repository: https://github.com/GorlikItsMe/nextjs-sentry-dont-work
When i enabled logs (
silent: false
in next.config.mjs) i saw this:Thank you in advance for any advice
Where in the product are you?
Unknown
Link
No response
DSN
No response
Version
No response
The text was updated successfully, but these errors were encountered: