As of v2.1.1, the following command throws an error, but ONLY when run via Fastlane's sh command. If run directly using the command below instead, it doesn't have issues.
Command that fastlane runs:
sh(
"appcenter", "codepush", "release-react",
"--app", [REDACTED],
"--deployment-name", "Prototype",
"--target-binary-version", "4.6.2",
"--output-dir", "build/android",
"--sourcemap-output-dir", "build/android/CodePush",
"--disable-duplicate-release-error"
"--debug"
)
Error:
info Writing bundle output to:, build/android/CodePush/index.android.bundle
info Writing sourcemap output to:, build/android/CodePush/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 192 asset files
info Done copying assets
Error: Failed to release a CodePush update.
This is the line it errors on using fastlane:
Based on where it fails on fastlane, this seems to be it detecting some sort of error happening under the hood that doesn't show when running with the debug flag for appcenter-cli.
When not using sh via fastlane to call that command and just running it directly, it successfully finishes and shows this instead:
Command:
appcenter codepush release-react --app [REDACTED] --deployment-name Prototype --target-binary-version 4.6.2 --output-dir build/android --sourcemap-output-dir build/android/CodePush --disable-duplicate-release-error --debug
info Writing bundle output to:, build/android/CodePush/index.android.bundle
info Writing sourcemap output to:, build/android/CodePush/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 192 asset files
info Done copying assets
Releasing update contents to CodePush:
[Warning] The uploaded package was not released because it is identical to the contents of the specified deployment's current release.
So something must have changed between 2.1.0 and 2.1.1 to cause this error to throw, as switching back and forth reproduces the issue using the same version of fastlane.
Also seeing this, I believe the error is coming from line 306 in react-native-utils.js:
.then((buildGradle: any) => {
return Array.from(buildGradle["project.ext.react"]).includes("enableHermes: true");
});
Trying to access ["project.ext.react"] using bracket notation won't work since buildGradle is an object and I don't think trying to get the nested value like that will work.
I believe it should be changed to something like: Array.from(buildGradle.ext.react) or something of the sort (logging my buildGradle showed it didn't have a "project" prop.
Thank you for having a look at this @NicholasGWK. I see what you mean. In the gradle-to-js library's parser.deepParse function, the out variable is an object. This is in the end returned by the parseFile function which we call. It starts off as just {} and then gets properties assigned using the bracket notation. Those properties are themselves objects coming from recursive calls to deepParse, so we need to access them in the way you suggest.
I do not have a setup ready to test the effect of this change, so I will discuss with my team how we can best get this out to you.
Another complaint on the issue: https://github.com/microsoft/appcenter-cli/issues/1249
Now that AppCenter announced that they'll deprecating the endpoints that are targeted below the 2.1.1 of codepush this needs to be addressed before the deadline day. Otherwise we won't be able to use it anymore :shrug:
Hi @carloscuesta,
Deprecation applies only to the distribution part. The CodePush part will work as before.
Hey @andreidubov then the information that is posted on the deprecation notice is misleading? 馃
If you are using the App Center CLI, please make sure to update to the latest version (2.7.3).
Understood! Thanks for clarifying will stick to 2.1.0 until this issue gets resolved 馃槉
@carloscuesta as it says:
As mentioned in the previous announcement, the following APIs are slated for deprecation (and have been marked as such in https://openapi.appcenter.ms)
- POST /v0.1/apps/ {owner_name }/ {app_name }/release_uploads
- PATCH /v0.1/apps/ {owner_name }/ {app_name }/release_uploads/ {upload_id}
These endpoints are used in the appcenter distribution releases command. They are not related to the appcenter codepush release command, so if your aim is to use only codepush commands,v2.1.0 will work as before. But we will investigate the problem on a new version.
Hi @jstheoriginal , we have reproduced the issue and added it to our backlog until it is fixed you can use the workaround described there #1249
Most helpful comment
Also seeing this, I believe the error is coming from line 306 in react-native-utils.js:
Trying to access ["project.ext.react"] using bracket notation won't work since buildGradle is an object and I don't think trying to get the nested value like that will work.
I believe it should be changed to something like:
Array.from(buildGradle.ext.react)or something of the sort (logging my buildGradle showed it didn't have a "project" prop.