Skip to content

Build fails since proxyLoader parses non-Sentry JSON file #6012

@stefan-girlich

Description

@stefan-girlich

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.16.0

Framework Version

7.16.0

Link to Sentry event

No response

Steps to Reproduce

  1. install via "getting started" guide
  2. install @sentry/integrations:7.1.6.0, apply CaptureConsoleIntegration in both sentry.client.config.js and sentry.server.config.js
  3. extract sentry.base.config.js from the two config files and import the new file - this is done since both files are fully identical (and probably irrelevant in the context of this bug report)
  4. run yarn build (which delegates to next build)

Expected Result

  • build succeeds
  • non-sentry JSON files are not processed by sentry during the build phase

Actual Result

build error

proxyLoader.jsfails to process a JSON file place in pages/. excerpt from the log:

./src/pages/badges/create/stepNames.json
Module parse failed: Unexpected token "i" (0x69) in JSON at position 0 while parsing near "import * as stepName..."
File was processed with these loaders:
 * ./node_modules/@sentry/nextjs/cjs/config/loaders/proxyLoader.js
You may need an additional loader to handle the result of these loaders.
JSONParseError: Unexpected token "i" (0x69) in JSON at position 0 while parsing near "import * as stepName..."
    at JsonParser.parse (myproject/node_modules/next/dist/compiled/webpack/bundle5.js:105017:7)

workaround

place JSON file in custom directory src/config

full log: 20221021_build.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions