Skip to content

Netlify build failing if target in next.config.js changed to experimental-serverless-trace #3932

Closed
@ani4aniket

Description

@ani4aniket

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

"@sentry/nextjs": "^6.11.0"

Description

Describe your issue in detail, ideally, you have a reproducible demo that you can show.
When the target in next.config.js from serverless to experimental-serverless-trace, in the resolution of #3575, Netlify build is failing,
throws an error: Cannot find module '@prisma/client'

Netlify Logs:
https://pastebin.com/6bExettA

next.config.js

const { withSentryConfig } = require('@sentry/nextjs');
const moduleExports = {
  /* config options here */
  target: 'experimental-serverless-trace',
  env: {
    API_ENDPOINT: process.env.API_ENDPOINT,
  },
  webpack5: false,
  webpack(config, { isServer, dev: isDevelopmentMode }) {
    config.module.rules.push({
      test: /\.svg$/,
      issuer: {
        test: /\.(js|ts)x?$/,
      },
      use: [
        {
          loader: '@svgr/webpack',
          // https://react-svgr.com/docs/options/
        },
      ],
    });

    config.module.rules.push({
      test: /\.po$/,
      use: [
        {
          loader: 'ignore-loader',
        },
      ],
    });

    // Fixes npm packages that depend on `fs` module
    if (!isServer) {
      config.node = {
        fs: 'empty',
      };
    }

    // Attempt to ignore storybook files when doing a production build,
    // see also: https://github.com/vercel/next.js/issues/1914
    if (!isDevelopmentMode) {
      config.module.rules.push({
        test: /\.stories.(js|tsx?)/,
        loader: 'ignore-loader',
      });
    }
    return config;
  },
  poweredByHeader: false,
  images: {
    domains: ['unsplash.com'],
  },
};

const SentryWebpackPluginOptions = {
  silent: true,
};

module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions