expo / turtle

Standalone app builder service
MIT License
385 stars 29 forks source link

Android builds with PKCS#12 keystores failing #276

Closed kratoskp closed 3 years ago

kratoskp commented 3 years ago

New Issue Checklist

Issue Description

Hi guys, not sure if this is the right place to report this but my build has been failing without any error logs. I've waited for quite some time for the logs to appear but none has appeared. This is the only error that I can see:

Your build is errored. No logs exist for this build yet. Once a build has logs they will appear here.

This is my build: https://expo.io/accounts/stackideas/builds/79adb602-b58e-4c61-9b60-4a73c1ecae20/logs

Command executed

expo build:android --non-interactive --release-channel easysocial-builder-33 --keystore-path=$EXPO_ANDROID_KEYSTORE_FILE --keystore-alias=$EXPO_ANDROID_KEYSTORE_ALIAS

Environment

 Expo CLI 3.28.4 environment info:
    System:
      OS: macOS 10.15.7
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 14.4.0 - /usr/local/bin/node
      Yarn: 1.22.5 - /usr/local/bin/yarn
      npm: 6.14.8 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.9.3 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: iOS 14.1, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    IDEs:
      Android Studio: 4.0 AI-193.6911.18.40.6626763
      Xcode: 12.1/12A7403 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^39.0.0 => 39.0.3 
      react: 16.13.1 => 16.13.1 
      react-native: https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz => 0.63.2 
      react-navigation: ^4.4.0 => 4.4.2 
    npmGlobalPackages:
      expo-cli: 3.28.4
    Expo Workflow: managed
 
brentvatne commented 3 years ago

this seems related to https://github.com/expo/expo-cli/issues/2845, no?

kratoskp commented 3 years ago

this seems related to expo/expo-cli#2845, no?

This one I build using different keystore as this is for a different app. Not sure if it's related or not. The keystore being use here is using RSA algorithm

wkozyra95 commented 3 years ago

I'm seeing error on the server related to keystore format, so yes It's probably is related to https://github.com/expo/expo-cli/issues/2845

Double Write for Keystore failed.
  err: {
   message: "Invalid PKCS#12 (.p12) keystore: PKCS12: bag is not a certificate"    
   name: "CredentialsAndroidKeystoreError"    
   stack: "CredentialsAndroidKeystoreError: Invalid PKCS#12 (.p12) keystore: PKCS12: bag is not a certificate
    at Function.getX509CertificateFromKeystore (/build/data/entities/credentials/PKCS12Utils.js:27:23)
    at Function.extractPkcsKeystoreHashesAsync (/build/data/entities/credentials/AndroidKeystoreEntity.js:70:51)
    at Function.extractPkcsKeystoreAsync (/build/data/entities/credentials/AndroidKeystoreEntity.js:109:44)
    at Function.updateAsync (/build/data/entities/credentials/AndroidKeystoreEntity.js:131:42)
    at Function.updateKeystore (/build/data/entities/credentials/AndroidCredentialsUtilsNewMutators.js:43:54)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /build/data/entities/credentials/AndroidCredentialsUtils.js:73:35
    at async /node_modules/@expo/entity/build/EntityQueryContextProvider.js:21:28" 
alanmurphy1987 commented 3 years ago

I am having the exact same issue on for my android builds - this only surfaced for me yesterday having previously been able to create builds. Very frustrating! The build id is referenced in the below URL https://expo.io/accounts/amurphy1987/projects/wildlife-app/builds/37673ec1-5b9b-4676-8336-31bc4c31a976. Is there any way I can bring this to expo for further information or gain more insight myself into why expo fails without logs?

Further Info:

Expo CLI 3.20.1 environment info:    System:      OS: macOS 10.15.2      Shell: 5.7.1 - /bin/zsh    Binaries:      Node: 14.1.0 - /usr/local/bin/node      npm: 6.14.4 - /usr/local/bin/npm    IDEs:      Android Studio: 3.6 AI-192.7142.36.36.6392135      Xcode: 11.7/11E801a - /usr/bin/xcodebuild    npmPackages:      expo: ~37.0.3 => 37.0.8       react: ~16.9.0 => 16.9.0       react-dom: ~16.9.0 => 16.9.0       react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4       react-native-web: ~0.11.7 => 0.11.7       react-navigation: ^4.3.9 => 4.3.9     npmGlobalPackages:      expo-cli: 3.20.1

rafaelvicio commented 3 years ago

I'm having the same problem at the moment, I tried again in version 3.28.5 of expo-cli but I still haven't been successful

kratoskp commented 3 years ago

@wkozyra95 Im still facing issue with build fails without any logs even though this issue https://github.com/expo/expo-cli/issues/2845 has been resolved

alanmurphy1987 commented 3 years ago

@wkozyra95 Im still facing issue with build fails without any logs even though this issue expo/expo-cli#2845 has been resolved

@wkozyra95 It may not be the case with you but if this is a new app listing like it is in my case I opted to allow expo create the keystore and that resolved it for me! It doesnt seem to error with their own ones.

I then made sure to run expo fetch:android:keystore to retrieve the keystore for use in later builds as I intend to manage it myself from here on out

In subsequent builds I am running expo build:android --clear-credentials and opt to use my own key

quinlanj commented 3 years ago

hi all! we made some pretty large refactors to our servers lately, and after digging through several ppl's errored build logs, we have a bug when we pass PKCS#12 keystores to our gradle scripts. I've got a fix out in our private repo's to amend this, i'll update this thread when it has been deployed. Really sorry for the inconvenience everyone :(

rafaelvicio commented 3 years ago

I successfully converted my .keystore certificate to .jks: https://stackoverflow.com/questions/49924556/convert-keystore-to-jks-to-sign-apk

keytool -importkeystore -srckeystore my.keystore -destkeystore new.jks -deststoretype jks

The new .jks certificate was successful in the expo build, and was accepted on Google Play

build id: b6ad256f-b0c6-48b5-9008-a58b8bede9ff

quinlanj commented 3 years ago

hi all, we've deployed a fix to our servers. Android builds with PKCS#12 keystores should be working now. If someone could please confirm this is the case, that'd be great. Thanks! @kratoskp

rafaelvicio commented 3 years ago

@quinlanj I was successful in build 👏👏👏

raphaelmatori commented 3 years ago

@rafaelvicio Me too! Thanks @quinlanj

quinlanj commented 3 years ago

great to hear 👍