Skip to content

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

Closed

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 * as Sentry from '@sentry/elysia';

Sentry.init({
  dsn: 'foobar',
  sendDefaultPii: true,
});

const app = Sentry.withElysia(new Elysia({ 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

  1. linear-code commented on May 26, 2026

    @linear-code
  2. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on May 26, 2026
  3. self-assigned this
    on May 26, 2026
  4. Lms24 commented on May 26, 2026

    @Lms24
    Member

    Hey @Kurzdor, thanks for reporting! I opened a PR with a fix: #21164

  5. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 26, 2026
  6. github-actions commented on May 28, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #21164, which was included in the 10.55.0 release.

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