bugsnag / bugsnag-expo

MIT License
11 stars 5 forks source link

EAS Build failure: Failed to load app.json file #118

Closed gburgett closed 1 year ago

gburgett commented 1 year ago

Describe the bug

Hello, I saw this failure in my EAS android build:

$ npx bugsnag-eas-build-on-success

Error: Failed to load app.json file /home/expo/workingdir/build/app.json.
Error: Cannot find module '/home/expo/workingdir/build/app.json'
Require stack:
- /home/expo/workingdir/build/node_modules/@bugsnag/plugin-expo-eas-sourcemaps/lib/eas-build-on-success.js

I believe it's because my Expo app uses app.config.ts instead of app.json. I noticed the eas-build-on-success.js file only looks for app.json:

let appConfig, apiKey
  try {
    appConfig = require(`${PROJECT_ROOT}/app.json`)
    apiKey = appConfig?.expo?.extra?.bugsnag?.apiKey
  } catch (error) {
    console.error(`Error: Failed to load app.json file ${PROJECT_ROOT}/app.json.\n${error}`)
    exit(1)
  }

It should also look for app.config.ts or app.config.js, the same way that Expo does.

Steps to reproduce

  1. Init a new Expo app
  2. Change app.json to app.config.js
  3. Submit an Android build to Expo EAS

Environment

yousif-bugsnag commented 1 year ago

Hi @gburgett thanks for reporting this!

This is actually a bug in the @bugsnag/plugin-expo-eas-sourcemaps package so I've transferred it to this repo.

We have now added a fix for this that will be published in the next release - we'll let you know when that is available.

gburgett commented 1 year ago

Thank you!

johnkiely1 commented 1 year ago

This has now been released in v48.1.0. Do let us know if you have any issues with this.