Skip to content

[@sentry/elysia] Type error when passing custom prefix to main Elysia instance #21159

Description

@Kurzdor

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/elysia

SDK Version

v. 10.53.1

Framework Version

Elysia v. 1.4.28

Link to Sentry event

No response

Reproduction Example/SDK Setup

import{Elysia}from'elysia';import*asSentryfrom'@sentry/elysia';Sentry.init({dsn: 'foobar',sendDefaultPii: true,});constapp=Sentry.withElysia(newElysia({prefix: '/api'})).get('/',()=>'ok').listen(3000);console.log(`Server running at http://${app.server?.hostname}:${app.server?.port}`,);

Steps to Reproduce

Try to add config.prefix for Elysia instance.

Expected Result

Adding config.prefix should not throw type errors.

Actual Result

Argument of type 'Elysia<"/api", { decorator: {}; store: {}; derive: {}; resolve: {}; }, { typebox: {}; error: {}; }, { schema: {}; standaloneSchema: {}; macro: {}; macroFn: {}; parser: {}; response: {}; }, {}, { derive: {}; resolve: {}; schema: {}; standaloneSchema: {}; response: {}; }, { ...; }>' is not assignable to parameter of type 'Elysia<"", { decorator: {}; store: {}; derive: {}; resolve: {}; }, { typebox: {}; error: {}; }, { schema: {}; standaloneSchema: {}; macro: {}; macroFn: {}; parser: {}; response: {}; }, {}, { derive: {}; resolve: {}; schema: {}; standaloneSchema: {}; response: {}; }, { ...; }>'.
The types of 'config.prefix' are incompatible between these types.
Type '"/api" | undefined' is not assignable to type '"" | undefined'.
Type '"/api"' is not assignable to type '""'.ts(2345)

Additional Context

No response

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

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