Building a react native app with expo and using eas build --platform ios following this guide: https://docs.expo.dev/build/setup/
I was getting a build error because i had secret variables in a file included on .gitignore, so I'm following the instructions on this stackoverflow post: EAS build fails : Unable to resolve module ./aws-exports
Instead of setting up the variables as suggested in the response to that post, I used eas secret. I have 4 secret environment variables set up with eas secret:create following this guide: https://docs.expo.dev/build-reference/variables/
In package.json, I have 4 scripts that get and decode these 4 variables with base64 --decode (base64 -d also gives identical results).
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"ukey": "echo $USER_KEY | base64 --decode > ./keys-iOS.js",
"pkey": "echo $PASS_KEY | base64 --decode > ./keys-iOS.js",
"tuser": "echo $TEST_USER | base64 --decode > ./keys-iOS.js",
"puser": "echo $TEST_PASS | base64 --decode > ./keys-iOS.js",
"eas-build-pre-install": "npm run ukey && npm run pkey && npm run tuser && npm run puser"
},
Building gives me this error in the logs:
Script 'eas-build-pre-install' is present in package.json, running it...
yarn run v1.22.17
$ npm run ukey && npm run pkey && npm run tuser && npm run puser
> teachassist@1.0.2 ukey
> echo $USER_KEY | base64 -d > ./keys-iOS.js
[stderr] Invalid character in input stream.
[stderr] error Command failed with exit code 65.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn exited with non-zero code: 65
A response to the linked stackoverflow post said that to solve this issue, i should use base64 -di.
I replaced each of the 4 commands with that and got this error:
Script 'eas-build-pre-install' is present in package.json, running it...
yarn run v1.22.17
$ npm run ukey && npm run pkey && npm run tuser && npm run puser
> teachassist@1.0.2 ukey
> echo $USER_KEY | base64 -di > ./keys-iOS.js
[stderr] base64: option requires an argument -- i
[stderr] Usage: base64 [-hvDd] [-b num] [-i in_file] [-o out_file]
[stderr] -h, --help display this message
[stderr] -Dd, --decode decodes input
[stderr] -b, --break break encoded string into num character lines
[stderr] -i, --input input file (default: "-" for stdin)
[stderr] -o, --output output file (default: "-" for stdout)
[stderr] error Command failed with exit code 64.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn exited with non-zero code: 64
I tried base64 -d -i and got the same error code 64.
How do I decode this successfully? Is there another issue I'm missing?