app-icon-badge icon indicating copy to clipboard operation
app-icon-badge copied to clipboard

build fail on expo eas build

Open bhyoo99 opened this issue 2 years ago โ€ข 8 comments

in eas prebuild [Android, iOS]

yarn run v1.22.19
$ /home/expo/workingdir/build/node_modules/.bin/expo prebuild --no-install --platform android
- Creating native project directories (./ios and ./android) and updating .gitignore
โœ” Created native project | gitignore skipped
- Updating your package.json scripts, dependencies, and main file
โœ” Updated package.json and added index.js entry point for iOS and Android
- Config syncing
Using node to generate images. This is much slower than using native packages.
โ€บ Optionally you can stop the process and try again after successfully running `npm install -g sharp-cli`.
- Config syncing
โœ– Config sync failed
Error: [android.dangerous]: withAndroidDangerousBaseMod: Unrecognised filter type - 255
Error: [android.dangerous]: withAndroidDangerousBaseMod: Unrecognised filter type - 255
    at n._reverseFilterLine (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:238258)
    at e.process (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:40580)
    at e.process (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:511680)
    at t.exports (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:420110)
    at e.read [as image/png] (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:1865)
    at Jimp.parseBitmap (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:125704)
    at Jimp.parseBitmap (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:8514)
    at /home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:7613
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
error Command failed with exit code 1.

draft solution ~~using v0.0.13 it works!~~ fail in ios too

bhyoo99 avatar Dec 14 '23 14:12 bhyoo99

@yjose Do you have any experience with this problem?

bhyoo99 avatar Feb 14 '24 15:02 bhyoo99

@bhyoo99 I am a bit confused because we are not using jimp-compact, so the error is probably not related to the plugin. Can you confirm that if you disable the plugin, the rebuild works correctly?

yjose avatar Feb 14 '24 16:02 yjose

Yes, I try without plugin, it works.

I'll test it in more ways and leave an additional message THX

bhyoo99 avatar Feb 15 '24 04:02 bhyoo99

Same issue locally with expo 50

PREBUILD] Error: [ios.dangerous]: withIosDangerousBaseMod: Could not find MIME for Buffer <null>piling react-native-screens Pods/RNScreens ยป RNSScreen.mm
[PREBUILD] Error: [ios.dangerous]: withIosDangerousBaseMod: Could not find MIME for Buffer <null>
[PREBUILD]     at Jimp.parseBitmap (/private/var/folders/b3/qq1v4qhj0h94_d12flgnqx840000gn/T/eas-build-local-nodejs/9e25bcba-b852-4352-89cf-201aed349a8a/build/node_modules/jimp-compact/dist/jimp.js:1:125518)
[PREBUILD]     at Jimp.parseBitmap (/private/var/folders/b3/qq1v4qhj0h94_d12flgnqx840000gn/T/eas-build-local-nodejs/9e25bcba-b852-4352-89cf-201aed349a8a/build/node_modules/jimp-compact/dist/jimp.js:1:8514)
[PREBUILD]     at /private/var/folders/b3/qq1v4qhj0h94_d12flgnqx840000gn/T/ea
s-build-local-nodejs/9e25bcba-b852-4352-89cf-201aed349a8a/build/node_modules/jimp-compact/dist/jimp.js:1:7613
[PREBUILD]     at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)
[PREBUILD] error: "expo" exited with code 1
[PREBUILD] 
Error: bun expo prebuild --no-install --platform ios exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/patwoz/.npm/_npx/1a85490733db6fa1/node_modules/@expo/spawn-async/build/spawnAsync.js:42:23)
    at Object.onceWrapper (node:events:633:26)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:518:28)
    at Pipe.<anonymous> (node:net:337:12)
    ...
    at spawnAsync (/Users/patwoz/.npm/_npx/1a85490733db6fa1/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23)
    at spawn (/Users/patwoz/.npm/_npx/1a85490733db6fa1/node_modules/@expo/turtle-spawn/dist/index.js:16:47)
    at runExpoCliCommand (/Users/patwoz/.npm/_npx/1a85490733db6fa1/node_modules/@expo/build-tools/dist/utils/project.js:37:47)
    at prebuildAsync (/Users/patwoz/.npm/_npx/1a85490733db6fa1/node_modules/@expo/build-tools/dist/common/prebuild.js:25:43)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/patwoz/.npm/_npx/1a85490733db6fa1/node_modules/@expo/build-tools/dist/builders/ios.js:58:13
    at async BuildContext.runBuildPhase (/Users/patwoz/.npm/_npx/1a85490733db6fa1/node_modules/@expo/build-tools/dist/context.js:98:28)
    at async buildAsync (/Users/patwoz/.npm/_npx/1a85490733db6fa1/node_modules/@expo/build-tools/dist/builders/ios.js:49:9)
    at async runBuilderWithHooksAsync (/Users/patwoz/.npm/_npx/1a85490733db6fa1/node_modules/@expo/build-tools/dist/builders/common.js:12:13)
    at async Object.iosBuilder (/Users/patwoz/.npm/_npx/1a85490733db6fa1/node_modules/@expo/build-tools/dist/builders/ios.js:28:16)

Build failed
Unknown error. See logs of the Prebuild build phase for more information.
npx exited with non-zero code: 1
    Error: build command failed.
error: script "ios" exited with code 1

patlux avatar Feb 25 '24 22:02 patlux

I'm also seeing the same fairly frequently - sometimes it works, and sometimes it doesn't:

Error: [android.dangerous]: withAndroidDangerousBaseMod: Could not find MIME for Buffer <null>
Error: [android.dangerous]: withAndroidDangerousBaseMod: Could not find MIME for Buffer <null>
    at Jimp.parseBitmap (/home/runner/work/mobile/mobile/node_modules/jimp-compact/dist/jimp.js:1:1255[18](https://github.com/shabados/mobile/actions/runs/8746039107/job/24002149044#step:7:19))
    at Jimp.parseBitmap (/home/runner/work/mobile/mobile/node_modules/jimp-compact/dist/jimp.js:1:8514)
    at /home/runner/work/mobile/mobile/node_modules/jimp-compact/dist/jimp.js:1:7613
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)

I currently suspect that sometimes the wrong file is being read in as an icon - that's what produces the error. Will dig in to see if there's anywhere this is possible...

harjot1singh avatar Apr 18 '24 23:04 harjot1singh

@Harjot1Singh Ok, Maybe I know what is causing the issue.

Normally, the function we are calling to add the badge is async, but the problem is that the config plugin don't support running async function and we mainly running it without await to prevent this issue.

Apparently, this is working for most cases but may cause this issue to appear sometimes. The solution is to look at how we can run the function using await and ensure that the new images are generated before updating the icon in the config.

@SihamBen can you help on that whenever you have some free time ๐Ÿ™

yjose avatar Apr 23 '24 11:04 yjose

Sounds about right, @yjose, thansk for getting back! I can think of 2 solutions:

  1. Export this as a mod instead of a plugin. This seems like a good use-case for a mod, which can be asynchronous
  2. "Cheat async" by blocking the return of the function until the promises have returned (by setting some sort of flag in a .finally call and polling with setTimeout etc)

harjot1singh avatar May 07 '24 01:05 harjot1singh

Quickly jumping here after some investigations.

my android build was failing on eas

CleanShot 2024-07-08 at 12 59 19@2x

I encountered the same messages as @Harjot1Singh

- Running prebuild
โœ– Prebuild failed
Error: [android.dangerous]: withAndroidDangerousBaseMod: Could not find MIME for Buffer <null>
Error: [android.dangerous]: withAndroidDangerousBaseMod: Could not find MIME for Buffer <null>
    at Jimp.parseBitmap (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:125518)
    at Jimp.parseBitmap (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:8514)

from my understanding the error message suggests Jimp encountered an issue parsing a buffer, possibly due to a missing or corrupt image file in your project.

I somehow solved the issue adding this on app.config.ts

  android: {
++    icon: "./assets/images/icon.png",
    adaptiveIcon: {
      foregroundImage: "./assets/images/adaptive-icon.png",
      backgroundColor: "#ffffff"
    },

I am not 100% convinced it is related but maybe it could help someone ๐Ÿ˜…

flexbox avatar Jul 08 '24 11:07 flexbox

Same issue for eas Android, any updates?

maksim-romanov avatar Oct 11 '24 11:10 maksim-romanov

same issue need updates

BLOCKMATERIAL avatar Oct 15 '24 13:10 BLOCKMATERIAL

- Creating native directory (./android)
โœ” Created native directory
- Updating package.json
โœ” Updated package.json | no changes
- Running prebuild
โœ– Prebuild failed
Error: [android.dangerous]: withAndroidDangerousBaseMod: Could not find MIME for Buffer <null>
Error: [android.dangerous]: withAndroidDangerousBaseMod: Could not find MIME for Buffer <null>
    at Jimp.parseBitmap (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:125518)
    at Jimp.parseBitmap (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:8514)
    at /home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:7613
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
error: "expo" exited with code 1
bun expo prebuild --no-install --platform android exited with non-zero code: 1

eas: "version": ">= 12.3.0",

BLOCKMATERIAL avatar Oct 19 '24 22:10 BLOCKMATERIAL

@Harjot1Singh, we tried using the mod to generate the icon with a badge, but it seems that Expo generates the native icons before running the plugin.

I am not sure about your second approach, to be honest. How can you do that?

For anyone who wants to play with it, here is the PR.

yjose avatar Oct 23 '24 11:10 yjose

@yjose just updated package, all works, thanks a lot!!!

maksim-romanov avatar Oct 28 '24 23:10 maksim-romanov

@maksim-romanov @yjose Thank you! Have a nice day :)

bhyoo99 avatar Oct 29 '24 06:10 bhyoo99

I'm still encountering this issue with Expo 52 and the latest version of this package. The problem occurs on both iOS and Android builds.

kutsan avatar Dec 06 '24 15:12 kutsan