Bare workflow - Task :app:bundleReleaseJsAndAssets fails on EAS, but passes locally

Hi. I’m able to build my project locally, but EAS fails every time. I googled this error a few times and no luck. Changed the version of react-native-agora a few times (and got different errors), but still the build fails. Build IDs: 15315d38-72b8-4989-b7e6-e9b1307c0d34, aa16faff-1208-4638-b6a8-d007c3d2fbd9

[stderr] error SyntaxError: /build/workingdir/build/my-app/node_modules/react-native-agora/src/common/RtcEngine.native.ts: Unexpected token (19:12)
[stderr]   17 |   WatermarkOptions,
[stderr]   18 | } from './Classes';
[stderr] > 19 | import type {
[stderr]      |             ^
[stderr]   20 |   AreaCode,
[stderr]   21 |   AudioEffectPreset,
[stderr]   22 |   AudioEqualizationBandFrequency,. Run CLI with --verbose flag for more details.
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
578 actionable tasks: 578 executed
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:bundleReleaseJsAndAssets'.

have you tried doing a local release build? npx react-native run-android --variant release - i expect you would get the same error

Had no problem running with --variant release. So far everything builds and runs just fine locally.

it looks like the more recent build had a completely different error message than shared above:

> Task :app:bundleReleaseJsAndAssets
[stderr] internal/fs/watchers.js:226
[stderr]     throw error;
[stderr]     ^
[stderr] Error: ENOENT: no such file or directory, watch '/build/workingdir/build/santa-casa-app/node_modules/react-native-agora/android/build/tmp/kotlin-classes/release/META-INF'
[stderr]     at FSWatcher.<computed> (internal/fs/watchers.js:218:26)
[stderr]     at Object.watch (fs.js:1525:34)
[stderr]     at NodeWatcher.watchdir (/build/workingdir/build/santa-casa-app/node_modules/sane/src/node_watcher.js:159:22)
[stderr]     at Walker.<anonymous> (/build/workingdir/build/santa-casa-app/node_modules/sane/src/common.js:109:31)
[stderr]     at Walker.emit (events.js:315:20)
[stderr]     at /build/workingdir/build/santa-casa-app/node_modules/walker/lib/walker.js:69:16
[stderr]     at FSReqCallback.oncomplete (fs.js:171:23) {
[stderr]   errno: -2,
[stderr]   syscall: 'watch',
[stderr]   code: 'ENOENT',
[stderr]   path: '/build/workingdir/build/santa-casa-app/node_modules/react-native-agora/android/build/tmp/kotlin-classes/release/META-INF',
[stderr]   filename: '/build/workingdir/build/santa-casa-app/node_modules/react-native-agora/android/build/tmp/kotlin-classes/release/META-INF'
[stderr] }

can you share your eas.json? what version of react-native-agora are you using?

The recent build is using version 3.3.1 of react-native-agora. The previous build is using 3.3.3.

My eas.json:

{
  "builds": {
    "android": {
      "release": {
        "workflow": "generic"
      }
    },
    "ios": {
      "release": {
        "workflow": "generic"
      }
    }
  }
}

can you try doing a fresh clone of your project to a new directory and building there with npx react-native run-android --variant release? i wonder if you’ll see the same error on the first run

A fresh clone did prompted the error. Problem is that now I have no idea how to fix it. :stuck_out_tongue:

if you can repro it in a new project with no minimal dependencies you can post an issue to react-native-agora about it. @wkozyra said:

maybe it’s some race condition with gradle scripts of the library, locally it might work because you run build twice and for the second run all files already exists.


it would increase your build times but you could try getting the failing build out of the way in a post-install script :\ eas-build-post-install

It was actually a problem with babel. After upgrading it the build passed. For future google searches: npx babel-upgrade --write && npm install && npm install --save-dev @babel/core @babel/cli

Thanks for the help!

hey! thanks for following up. i’m glad to hear you were able to resolve it.