Skip to content

TypeError: Invalid state: Controller is already closed from Sentry Astro middleware #16491

Description

@jongjunpark

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

  1. Install and configure @sentry/astro in an Astro project.
import node             from '@astrojs/node';
import react            from '@astrojs/react';
import { defineConfig } from 'astro/config';
import sentry from '@sentry/astro';
import { loadEnv } from "vite";
import pkg from "./package.json";


const { PUBLIC_SENTRY_AUTH_TOKEN, PUBLIC_SENTRY_DSN } = loadEnv(process.env.NODE_ENV || 'development', process.cwd(), "");

export default defineConfig({
  integrations: [react(), sentry({
    dsn: PUBLIC_SENTRY_DSN,
    release: `io-shell@${pkg.version}`,
    sourceMapsUploadOptions: {
      project: "my-project",
      org: "my-org",
      authToken: PUBLIC_SENTRY_AUTH_TOKEN,
    },
  })],
  output: 'server',
  adapter: node({
    mode: 'standalone',
  }),
  server: {
    host: '0.0.0.0',
  },
  build: {
    assets: 'io/_astro'
  },
  experimental: {
    svg: true
  }
});
  1. Collect issues using Sentry SaaS in a deployed application.
  2. The following error keeps occurring in the server middleware of @sentry/astro:
    • TypeError: Invalid state: Controller is already closed

Expected Result

no issue in @sentry/astro

Actual Result

TypeError
Invalid state: Controller is already closed

issue from node_modules/.pnpm/@sentry+astro@9.25.1_astro@5.5.5_@types+node@22.15.3_jiti@1.21.7_rollup@4.37.0_sass@1.8_a7e017124249dc9628fe25e51673e2f3/node_modules/@sentry/astro/build/esm/server/middleware.js

Image

Product Area

Issues

Link

https://imweb-jm.sentry.io/issues/6655871353/?project=4509439058903040&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&sort=freq&stream_index=0

DSN

https://ae0f622d57003e90e7b2c6a19ca18a4d@o4509241587597312.ingest.us.sentry.io/4509439058903040

Version

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions