Skip to content

Error integrating sveltekit and capacitor #13682

@KarlChr

Description

@KarlChr

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/sveltekit

SDK Version

sveltekit 8.30.0, capacitor 0.19.0

Framework Version

Sveltekit 2.0.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

import * as SentrySveltekit from '@sentry/sveltekit'
import * as SentryVue from '@sentry/vue'
import * as Sentry from '@sentry/capacitor'

Sentry.init({
  dsn: '',
  dist: "",
  integrations: [],
}, SentrySveltekit.init)
// SentrySveltekit.init shows a type mismatch error
// Whereas SentryVue.init does not

Steps to Reproduce

Run the development server using the above code in hooks.client.ts

Expected Result

Integrating @sentry/capacitor and @sentry/sveltekit

Actual Result

When defining the integrationsarray this error is shown:

Type 'Integration[]' is not assignable to type '((Integration[] | ((integrations: Integration[]) => Integration[])) & (Integration[] | ((integrations: Integration[]) => Integration[]))) | undefined'.
  Type 'Integration[]' is not assignable to type '((integrations: Integration[]) => Integration[]) & Integration[]'.
    Type 'Integration[]' is not assignable to type '(integrations: Integration[]) => Integration[]'.
      Type 'Integration[]' provides no match for the signature '(integrations: Integration[]): Integration[]'.ts(2322)
options.d.ts(274, 5): The expected type comes from property 'integrations' which is declared here on type 'CapacitorOptions & (Options<BaseTransportOptions> | BrowserOptions | NodeOptions)'

if the integration array is removed and the development server is started this error is shown in the browsers console

@sentry_capacitor.js?v=bf718813:25857 Uncaught (in promise) TypeError: addGlobalEventProcessor2 is not a function
    at _SdkInfo.setupOnce (@sentry_capacitor.js?v=bf718813:25857:5)
    at setupIntegration (@sentry_sveltekit.js?v=bf718813:5522:17)
    at @sentry_sveltekit.js?v=bf718813:5503:7
    at Array.forEach (<anonymous>)
    at setupIntegrations (@sentry_sveltekit.js?v=bf718813:5501:16)
    at BrowserClient._setupIntegrations (@sentry_sveltekit.js?v=bf718813:5815:26)
    at BrowserClient.init (@sentry_sveltekit.js?v=bf718813:5722:12)
    at initAndBind (@sentry_sveltekit.js?v=bf718813:6169:10)
    at init (@sentry_sveltekit.js?v=bf718813:10650:18)
    at init2 (@sentry_sveltekit.js?v=bf718813:22858:18)
    at init3 (@sentry_sveltekit.js?v=bf718813:24125:18)
    at Module.init2 (@sentry_capacitor.js?v=bf718813:26137:3)
    at hooks.client.ts:6:8

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPackage: svelteIssues related to the Sentry Svelte SDK

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions