obytes / app-icon-badge

🧩 Expo plugin/library to add badges for your app icon: banner, ribbon, and fully customizable.
268 stars 6 forks source link

build fail on expo eas build #31

Open bhyoo99 opened 9 months ago

bhyoo99 commented 9 months ago

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 commented 7 months ago

@yjose Do you have any experience with this problem?

yjose commented 7 months ago

@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?

bhyoo99 commented 7 months ago

Yes, I try without plugin, it works.

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

patlux commented 7 months ago

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
Harjot1Singh commented 5 months ago

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...

yjose commented 5 months ago

@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 🙏

Harjot1Singh commented 5 months ago

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)

flexbox commented 2 months ago

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 😅