0

Not sure why I am getting this error since obviously bugsnag is defined if it is passing the error to the bugsnag console:

enter image description here

Here is my bugsnag file:

import { Client } from 'bugsnag-react-native';
import Config from 'react-native-config'

export const bugsnag = new Client(Config.BUGSNAG_KEY);

config has the correct API key

here is my error file:

import bugsnag from './bugsnag'

    export default function (err) {
      console.log("BUGSNAG ERR", err);
      if (err) {
        if (!err.stack) {
          err = new Error(err)
        }
        bugsnag.notify.apply(bugsnag, [err])
      }
    }

And here is my index.js

// eslint-disable-next-line no-unused-vars
import bugsnag from './app/configs/bugsnag';

I have tried to follow all the react native setup from bugsnags docs, but obviously I am missing something. All help is appreciated.

Stephen Phillips
  • 641
  • 10
  • 26

1 Answers1

0

The issue was how I imported the file:

since i used:

export const bugsnag

I needed to use:

import { bugsnag } from './bugsnag'

Based off this article:

https://medium.com/@etherealm/named-export-vs-default-export-in-es6-affb483a0910

Stephen Phillips
  • 641
  • 10
  • 26