Skip to content
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

Uploading source maps breaks standalone nextjs build #13819

Closed
ferdy-roz opened this issue Sep 27, 2024 · 9 comments
Closed

Uploading source maps breaks standalone nextjs build #13819

ferdy-roz opened this issue Sep 27, 2024 · 9 comments

Comments

@ferdy-roz
Copy link

Environment

SaaS (https://sentry.io/)

What are you trying to accomplish?

I ran the sentry wizard to set up our nextjs project. We are trying to deploy our app with sentry and upload source maps in CI.

How are you getting stuck?

We deploy via CodeBuild, and when we try to upload source maps we never get to the step of generating the standalone folder, set by setting output: "standalone" in next.config.mjs. I disabled sourcemaps in the sentry config and our build succeds/

Where in the product are you?

Issues - Source Maps

Link

No response

DSN

"https://8fe17b8c457f194e13b3f2c59119b9d6@o4507782612582400.ingest.us.sentry.io/4508016741187584"

Version

No response

@getsantry
Copy link

getsantry bot commented Sep 27, 2024

Assigning to @getsentry/support for routing ⏲️

@rodolfoBee rodolfoBee transferred this issue from getsentry/sentry Sep 27, 2024
@getsantry getsantry bot moved this from Waiting for: Support to Waiting for: Product Owner in GitHub Issues with 👀 3 Sep 27, 2024
@chargome
Copy link
Member

Hey @ferdy-roz, could you paste your full next.config.mjs?

@ferdy-roz
Copy link
Author

// @ts-check

import { withSentryConfig } from "@sentry/nextjs";
import createNextIntlPlugin from "next-intl/plugin";
import relayConfig from "./relay.config.json" with { type: "json" };

const withNextIntl = createNextIntlPlugin();

const config = withNextIntl({
  output: "standalone",
  compiler: {
    // @ts-ignore
    relay: relayConfig,
    removeConsole: process.env.NODE_ENV === "production",
  },
  experimental: {
    instrumentationHook: true,
  },
});

export default withSentryConfig(config, {
  // For all available options, see:
  // https://github.com/getsentry/sentry-webpack-plugin#options

  org: "tendrel",
  project: "console",
  sentryUrl: "https://sentry.io",

  // Only print logs for uploading source maps in CI
  silent: false,
  debug: true,

  // 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,
});

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Sep 27, 2024
@chargome
Copy link
Member

@ferdy-roz what error are you facing exactly? Please add debug: true to your config and check the logs

@ferdy-roz
Copy link
Author

The final error we get is

ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 657cbd75-9081-4938-9b4d-b0acd7e92ab0::3crt0ifuo3q0zbd3t545ivaif: "/app/.next/standalone": not found
833 | upload resources required for deployment for console: build and push the image "console": build Dockerfile at /codebuild/output/src653262304/src/Dockerfile: building image: exit status 1
834 | Cloudformation stack and config files were not generated. Please check build logs to see if there was a manifest validation error.
835

but that's just the standalone directory not getting generated. Wasn't sure if something earlier in the process stopped us from getting there. I had tried setting debug: true but there weren't any more enlightening logs. I'll keep diving though.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Sep 30, 2024
@chargome
Copy link
Member

If you can, please provide a small reproducible example!

@ferdy-roz
Copy link
Author

I ended up adding a wait to our docker jobs and it somehow worked.. So maybe there was something weird on our end. It was hard to repro in a small way just because there was a lot of infra and everything, but it seems to be resolved!

@Vi-lka
Copy link

Vi-lka commented Oct 21, 2024

@ferdy-roz Can you provide a code example of how you solved this problem? I ran into the same problem and I still can't solve it.

@Vi-lka
Copy link

Vi-lka commented Oct 21, 2024

Adding webpack configuration to next config breaks output: "standalone".
experimental: { webpackBuildWorker: true }
fixed the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants