Skip to content

Commit

Permalink
fix: don't shutdown Sentry SDK after build in dev mode (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl committed Apr 11, 2023
1 parent 4bdd341 commit b4c1312
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
name: Use Node.js ${{ matrix.node-version }}
name: Lint and test
runs-on: ubuntu-latest
env:
CI: true
Expand Down
4 changes: 2 additions & 2 deletions src/hooks.ts
Expand Up @@ -149,15 +149,15 @@ export async function initializeServerSentry (nuxt: Nuxt, moduleOptions: ModuleC
const serverOptions = await resolveServerOptions(nuxt, moduleOptions, logger)
const config: Options = defu({ release }, serverOptions.config)

process.sentry = Sentry

if (canInitialize(moduleOptions)) {
Sentry.init(config)
sentryHandlerProxy.errorHandler = Sentry.Handlers.errorHandler()
sentryHandlerProxy.requestHandler = Sentry.Handlers.requestHandler(moduleOptions.requestHandlerConfig)
if (serverOptions.tracing) {
sentryHandlerProxy.tracingHandler = Sentry.Handlers.tracingHandler()
}

process.sentry = Sentry
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/module.ts
Expand Up @@ -141,7 +141,7 @@ export default defineNuxtModule<ModuleConfiguration>({
// the release version has been determined and the options template created but before
// the build is started (if building).
if (isNuxt2()) {
const isBuilding = nuxt.options._build
const isBuilding = nuxt.options._build && !nuxt.options.dev
const initHook = isBuilding ? 'build:compile' : 'ready'
nuxt.hook(initHook, () => initializeServerSentry(nuxt, options, sentryHandlerProxy, logger))
const shutdownHook = isBuilding ? 'build:done' : 'close'
Expand Down

0 comments on commit b4c1312

Please sign in to comment.