Skip to content

Deno.serve wrapper throws when there is no client #23894

Description

@isaacs

packages/deno/src/wrap-deno-request-handler.ts:49:

const client = getClient();
if (!client) {
  throw new Error('could not get Deno client. Did you run Sentry.init?');
}

Once denoServeIntegration has patched Deno.serve, the patch outlives the client. After Sentry.close(), or if a second init() fails, every incoming request throws before reaching the user's handler. Cloudflare's equivalent (wrapRequestHandlerWithInit) treats client === undefined as a pass-through and never blocks the request.

Work item. Replace the throw with a pass-through to handler() plus a debug.warn. Add a test that calls the wrapped handler with no client bound and asserts the user's response still comes back.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDenojavascriptPull requests that update javascript code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions