sentry-capacitor icon indicating copy to clipboard operation
sentry-capacitor copied to clipboard

Missing outboxPath error when sending event from android with capacitor 3 and vuejs 3

Open Ramouchau opened this issue 3 years ago • 4 comments

Environment

I use sentry.io with capactior 3.3.2 , vue 3.2.23, @sentry/capacitor 0.4.1, @sentry/tracing 6.15.0, @sentry/vue 6.15.0,

Steps to Reproduce

my main.ts

import './theme/scss/global.scss'
import { createApp } from 'vue'
import { Store } from 'vuex'
import { store, RootActionsTypes } from '@/store'
import App from './App.vue'
import router from './router'
import { IonicVue } from '@ionic/vue'
import { useFirebaseAnalytics } from './modules/firebase-analytics'
import { useAwsAmplify } from './modules/aws-amplify'
import { useVueI18n } from './modules/vue-i18n'
import { useGooglemaps } from './modules/googlemaps'
import { useSentry } from './modules/sentry'

const startApp = async () => {
  await Promise.all([useFirebaseAnalytics(), useGooglemaps()])
  useAwsAmplify()

  const app = createApp(App)
    .use(IonicVue)
    .use(router)
    .use(store as Store<any>)
  useVueI18n(app)
  useSentry(app)

  store.dispatch(RootActionsTypes.INSTANTIATE_API)
  await router.isReady()
  app.mount('#app')
}

startApp()

modules/sentry.ts

import { App } from 'vue'
import * as Sentry from '@sentry/capacitor'
import * as SentryVue from '@sentry/vue'
import '@sentry/tracing'

const {
  VUE_APP_SENTRY_DSN = 'mydns',
  VUE_APP_ENV = 'dev'
} = process.env

export const useSentry = (app: App) => {
  Sentry.init(
    {
      app: app,
      dsn: VUE_APP_SENTRY_DSN,
      environment: VUE_APP_ENV,
      release: `myapp@${process.env.npm_package_version}`,
      dist: '1',
      tracesSampleRate: 0.1,
      debug: VUE_APP_ENV === 'dev'
    },
    SentryVue.init
  )
}

Expected Result

should send error to sentry.io

Actual Result

work fine on web version, but when build on android every time an event is sent I have "Missing outboxPath" errors in android studio logs and nothing is sent.

logcat when event is send from android

2021-11-30 17:49:14.280 21501-14000/fr.medicalib.pro V/Capacitor: callback: 22166592, pluginId: SentryCapacitor, methodName: getStringBytesLength, methodData: {"string":"{\"exception\":{\"values\":[{\"type\":\"Error\",\"value\":\"test error home\",\"stacktrace\":{\"frames\":[{\"colno\":160382,\"filename\":\"app:\/\/\/js\/chunk-vendors.a174dc9f.js\",\"function\":\"M\",\"in_app\":true,\"lineno\":340},{\"colno\":155350,\"filename\":\"app:\/\/\/js\/chunk-vendors.a174dc9f.js\",\"function\":\"ot\",\"in_app\":true,\"lineno\":340},{\"filename\":\"app:\/\/\/<anonymous>\",\"function\":\"Array.forEach\",\"in_app\":true},{\"colno\":155361,\"filename\":\"app:\/\/\/js\/chunk-vendors.a174dc9f.js\",\"function\":\"?\",\"in_app\":true,\"lineno\":340},{\"colno\":170318,\"filename\":\"app:\/\/\/js\/chunk-vendors.a174dc9f.js\",\"function\":\"o\",\"in_app\":true,\"lineno\":340},{\"colno\":3939,\"filename\":\"app:\/\/\/js\/chunk-a789fd9c.0ead8623.js\",\"function\":\"?\",\"in_app\":true,\"lineno\":1}]},\"mechanism\":{\"handled\":false,\"type\":\"onunhandledrejection\"}}]},\"level\":\"error\",\"platform\":\"javascript\",\"event_id\":\"759367199e3743daa85a83c28a853628\",\"timestamp\":1638290954.263,\"environment\":\"dev\",\"release\":\"medicalib-app-pro@undefined\",\"dist\":\"1\",\"sdk\":{\"integrations\":[\"InboundFilters\",\"FunctionToString\",\"TryCatch\",\"Breadcrumbs\",\"GlobalHandlers\",\"LinkedErrors\",\"Dedupe\",\"UserAgent\",\"RewriteFrames\",\"SdkInfo\",\"EventOrigin\"],\"name\":\"sentry.javascript.capacitor\",\"packages\":[{\"name\":\"npm:@sentry\/capacitor\",\"version\":\"0.4.1\"}],\"version\":\"0.4.1\"},\"breadcrumbs\":[{\"timestamp\":1638290928.6,\"category\":\"console\",\"data\":{\"arguments\":[{\"message\":\"Converting circular structure to JSON\\n    --> starting at object with constructor 'Object'\\n    |     property '_context' -> object with constructor 'Object'\\n    --- property 'app' closes the circle\",\"name\":\"TypeError\",\"stack\":\"TypeError: Converting circular structure to JSON\\n    --> starting at object with constructor 'Object'\\n    |     property '_context' -> object with constructor 'Object'\\n    --- property 'app' closes the circle\\n    at JSON.stringify (<anonymous>)\\n    at postToNative (http:\/\/localhost\/:310:60)\\n    at Object.cap.toNative (http:\/\/localhost\/:380:25)\\n    at http:\/\/localhost\/:461:25\\n    at new Promise (<anonymous>)\\n    at Object.cap.nativePromise (http:\/\/localhost\/:460:24)\\n    at Object.t.initNativeSdk (http:\/\/localhost\/:914:20)\\n    at Object.<anonymous> (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:246:4255)\\n    at u (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:203:13591)\\n    at Object.next (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:203:12886)\\n    at http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:203:12611\\n    at new Promise (<anonymous>)\\n    at l (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:203:12404)\\n    at Object.initNativeSdk (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:246:3680)\\n    at Object.kn (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:246:9907)\\n    at V (http:\/\/localhost\/js\/app.8870b6c0.js:1:154547)\\n    at http:\/\/localhost\/js\/app.8870b6c0.js:1:155697\\n    at l (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:117:24342)\\n    at Generator._invoke (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:117:25668)\\n    at Generator.next (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:117:24767)\\n    at r (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:32:20692)\\n    at s (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:32:20895)\"}],\"logger\":\"console\"},\"level\":\"error\",\"message\":\"TypeError: Converting circular structure to JSON\\n    --> starting at object with constructor 'Object'\\n    |     property '_context' -> object with constructor 'Object'\\n    --- property 'app' closes the circle\"},{\"timestamp\":1638290929.391,\"category\":\"fetch\",\"data\":{\"method\":\"GET\",\"url\":\"https:\/\/apigw.awsdev.medicalib.fr\/iam\/users\/me\",\"status_code\":200},\"type\":\"http\"},{\"timestamp\":16382
2021-11-30 17:49:14.286 21501-14000/fr.medicalib.pro V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 22166593, pluginId: SentryCapacitor, methodName: captureEnvelope
2021-11-30 17:49:14.287 21501-14000/fr.medicalib.pro V/Capacitor: callback: 22166593, pluginId: SentryCapacitor, methodName: captureEnvelope, methodData: {"envelope":"{\"event_id\":\"759367199e3743daa85a83c28a853628\",\"sdk\":{\"integrations\":[\"InboundFilters\",\"FunctionToString\",\"TryCatch\",\"Breadcrumbs\",\"GlobalHandlers\",\"LinkedErrors\",\"Dedupe\",\"UserAgent\",\"RewriteFrames\",\"SdkInfo\",\"EventOrigin\"],\"name\":\"sentry.javascript.capacitor\",\"packages\":[{\"name\":\"npm:@sentry\/capacitor\",\"version\":\"0.4.1\"}],\"version\":\"0.4.1\"}}\n{\"content_type\":\"application\/json\",\"length\":12747,\"type\":\"event\"}\n{\"exception\":{\"values\":[{\"type\":\"Error\",\"value\":\"test error home\",\"stacktrace\":{\"frames\":[{\"colno\":160382,\"filename\":\"app:\/\/\/js\/chunk-vendors.a174dc9f.js\",\"function\":\"M\",\"in_app\":true,\"lineno\":340},{\"colno\":155350,\"filename\":\"app:\/\/\/js\/chunk-vendors.a174dc9f.js\",\"function\":\"ot\",\"in_app\":true,\"lineno\":340},{\"filename\":\"app:\/\/\/<anonymous>\",\"function\":\"Array.forEach\",\"in_app\":true},{\"colno\":155361,\"filename\":\"app:\/\/\/js\/chunk-vendors.a174dc9f.js\",\"function\":\"?\",\"in_app\":true,\"lineno\":340},{\"colno\":170318,\"filename\":\"app:\/\/\/js\/chunk-vendors.a174dc9f.js\",\"function\":\"o\",\"in_app\":true,\"lineno\":340},{\"colno\":3939,\"filename\":\"app:\/\/\/js\/chunk-a789fd9c.0ead8623.js\",\"function\":\"?\",\"in_app\":true,\"lineno\":1}]},\"mechanism\":{\"handled\":false,\"type\":\"onunhandledrejection\"}}]},\"level\":\"error\",\"platform\":\"javascript\",\"event_id\":\"759367199e3743daa85a83c28a853628\",\"timestamp\":1638290954.263,\"environment\":\"dev\",\"release\":\"medicalib-app-pro@undefined\",\"dist\":\"1\",\"sdk\":{\"integrations\":[\"InboundFilters\",\"FunctionToString\",\"TryCatch\",\"Breadcrumbs\",\"GlobalHandlers\",\"LinkedErrors\",\"Dedupe\",\"UserAgent\",\"RewriteFrames\",\"SdkInfo\",\"EventOrigin\"],\"name\":\"sentry.javascript.capacitor\",\"packages\":[{\"name\":\"npm:@sentry\/capacitor\",\"version\":\"0.4.1\"}],\"version\":\"0.4.1\"},\"breadcrumbs\":[{\"timestamp\":1638290928.6,\"category\":\"console\",\"data\":{\"arguments\":[{\"message\":\"Converting circular structure to JSON\\n    --> starting at object with constructor 'Object'\\n    |     property '_context' -> object with constructor 'Object'\\n    --- property 'app' closes the circle\",\"name\":\"TypeError\",\"stack\":\"TypeError: Converting circular structure to JSON\\n    --> starting at object with constructor 'Object'\\n    |     property '_context' -> object with constructor 'Object'\\n    --- property 'app' closes the circle\\n    at JSON.stringify (<anonymous>)\\n    at postToNative (http:\/\/localhost\/:310:60)\\n    at Object.cap.toNative (http:\/\/localhost\/:380:25)\\n    at http:\/\/localhost\/:461:25\\n    at new Promise (<anonymous>)\\n    at Object.cap.nativePromise (http:\/\/localhost\/:460:24)\\n    at Object.t.initNativeSdk (http:\/\/localhost\/:914:20)\\n    at Object.<anonymous> (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:246:4255)\\n    at u (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:203:13591)\\n    at Object.next (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:203:12886)\\n    at http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:203:12611\\n    at new Promise (<anonymous>)\\n    at l (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:203:12404)\\n    at Object.initNativeSdk (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:246:3680)\\n    at Object.kn (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:246:9907)\\n    at V (http:\/\/localhost\/js\/app.8870b6c0.js:1:154547)\\n    at http:\/\/localhost\/js\/app.8870b6c0.js:1:155697\\n    at l (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:117:24342)\\n    at Generator._invoke (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:117:25668)\\n    at Generator.next (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:117:24767)\\n    at r (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:32:20692)\\n    at s (http:\/\/localhost\/js\/chunk-vendors.a174dc9f.js:32:20895)\"}],\"logger\":
2021-11-30 17:49:14.287 21501-13950/fr.medicalib.pro I/capacitor-sentry: Error when writing envelope, no outbox path is present.
2021-11-30 17:49:14.288 21501-13950/fr.medicalib.pro D/Capacitor: Sending plugin error: {"save":false,"callbackId":"22166593","pluginId":"SentryCapacitor","methodName":"captureEnvelope","success":false,"error":{"message":"Missing outboxPath"}}
2021-11-30 17:49:14.296 21501-14000/fr.medicalib.pro V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 22166594, pluginId: SentryCapacitor, methodName: addBreadcrumb
2021-11-30 17:49:14.297 21501-14000/fr.medicalib.pro V/Capacitor: callback: 22166594, pluginId: SentryCapacitor, methodName: addBreadcrumb, methodData: {"timestamp":1.638290954294E9,"category":"console","data":{"arguments":"[{\"message\":\"Missing outboxPath\"}]","logger":"console"},"level":"error","message":"[object Object]"}
2021-11-30 17:49:14.300 21501-21501/fr.medicalib.pro E/Capacitor/Console: File: http://localhost/js/chunk-vendors.a174dc9f.js - Line 232 - Msg: Sentry Logger [Error]: Error while sending event: Error: Missing outboxPath
2021-11-30 17:49:49.654 21501-14000/fr.medicalib.pro V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 22166595, pluginId: SentryCapacitor, methodName: addBreadcr

Ramouchau avatar Dec 01 '21 09:12 Ramouchau

Is this happening on Android only? That's odd as the outbox path should be picked up automatically by the Android SDK. Unless I'm mistaken. @marandaneto any ideas?

bruno-garcia avatar Jan 11 '22 22:01 bruno-garcia

Is this happening on Android only? That's odd as the outbox path should be picked up automatically by the Android SDK. Unless I'm mistaken. @marandaneto any ideas?

cacheDirPath and outboxPath are set during SDK init., if captureEnvelope is being called before initNativeSdk, that could be the problem

marandaneto avatar Jan 12 '22 10:01 marandaneto

Is this happening on Android only? That's odd as the outbox path should be picked up automatically by the Android SDK. Unless I'm mistaken. @marandaneto any ideas?

Yes only on Android the ios build work as intended

Ramouchau avatar Jan 12 '22 21:01 Ramouchau

if captureEnvelope is being called before initNativeSdk, that could be the problem

By any chance this is the case?

bruno-garcia avatar Mar 15 '22 18:03 bruno-garcia

Closing this since I was not able to reproduce the error with the latest version of Sentry Capacitor. Feel free to reopen if the error persists on your side.

lucas-zimerman avatar Sep 20 '22 12:09 lucas-zimerman