Skip to content

Next.js plugin doesn't work with next-pwa plugin #213 #3538

Closed
@abordeau

Description

@abordeau

Summary

I tried to use the sentry integration with the next-pwa plugin but the service-worker is not register in this configuration.

Versions

  • next-pwa: 3.1.0
  • next:10.2.0
  • @sentry/nextjs: ^6.3.6

How To Reproduce

Steps to reproduce the behavior:

  1. Clone this repo
  2. Install the app with yarn install and run it with yarn dev
  3. Open the navigator on http://localhost:3000/
  4. Check if a service worker is registered in the chrome dev tools

Expected Behaviors

The sw.js file and the workbox.js are created in the public folder but they are not registered by the browser. It only occured when using withSentryConfig.

This is the next.config.js file I used :

const withPWA = require('next-pwa')
const runtimeCaching = require('next-pwa/cache')
const { withSentryConfig } = require('@sentry/nextjs')

const moduleExports = withPWA({
  pwa: {
    dest: 'public',
    runtimeCaching,
  },
})

const SentryWebpackPluginOptions = {
  // Additional config options for the Sentry Webpack plugin. Keep in mind that
  // the following options are set automatically, and overriding them is not
  // recommended:
  //   release, url, org, project, authToken, configFile, stripPrefix,
  //   urlPrefix, include, ignore
  // For all available options, see:
  // https://github.com/getsentry/sentry-webpack-plugin#options.
}

// With this config, the service worker  is not registered by the browser
module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions)

// This config works
// module.exports = moduleExports

Metadata

Metadata

Assignees

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