expo / custom-expo-updates-server

238 stars 67 forks source link

OTA works with manual build but not with managed flow #22

Closed RomeHein closed 1 year ago

RomeHein commented 1 year ago

Hello there 👋

I have an issue running an OTA with the expo manage flow.

From the stack trace it seems that there is an issue with the updateId. But I have no idea how this variable interact with the update flow.

So to sum up:

Here is my app.json:

{
    "expo": {
        "name": "HelloTest",
        "slug": "HelloTest-chat-mobile",
        "privacy": "public",
        "platforms": [
            "ios",
            "android"
        ],
        "runtimeVersion": "1",
        "version": "2.2.3",
        "orientation": "portrait",
        "icon": "./assets/icon.png",
        "splash": {
            "image": "./assets/splash-v2.png",
            "resizeMode": "contain",
            "backgroundColor": "#fff"
        },
        "updates": {
            "url": "https://eas-update.helloTest.eu/api/manifest",
            "enabled": true,
            "fallbackToCacheTimeout": 30000,
            "codeSigningCertificate": "./code-signing/certificate.pem",
            "codeSigningMetadata": {
                "keyid": "main",
                "alg": "rsa-v1_5-sha256"
            }
        },
        "assetBundlePatterns": [
            "**/*"
        ],
        "ios": {
            "buildNumber": "1",
            "supportsTablet": false,
            "usesIcloudStorage": true,
            "usesAppleSignIn": true,
            "bundleIdentifier": "com.helloTest.mobilechat",
            }
        },
        "android": {
            "package": "com.helloTest.mobilechat",
            "googleServicesFile": "./google-services.json",
            "icon": "./assets/icon.png",
            "adaptiveIcon": {
                "foregroundImage": "./assets/android-foreground-icon.png",
                "backgroundColor": "#69BEA7"
            },
            "versionCode": 223,
            "permissions": [
                "CAMERA",
            ]
        },
        "scheme": "helloTest",
        "plugins": [
            "sentry-expo"
        ]
    }
}

And here is the request header I receive and then print from the eas-server (the one on netlify), once all if conditions are passed (all IPs, IDs and cookies are fake) :

{
  host: 'eas-update.helloTest.eu',
  accept: 'multipart/mixed,application/expo+json,application/json',
  'accept-encoding': 'br',
  'accept-language': 'en-US,en;q=0.9',
  cookie: '_session_id=1k1kwZZkEFXOI5Ipe3pjDjVCuqPg4NtJBgoUe5szPvkorlp5ZCuOVW6ZFr9D7l2i4njHZIR%2Fa3AS2XAS8WGWLIcg7%2FCRW1B2qTsKaI5Vi%2BkDs4IDZsKG%2Fz1LzBHds8SyzgSEPbxN22cdI%2FQZvzvD6s211rAofVd2EFXchbfo4CO41IX0%2B9oY%2BoHjwshR2AUNoDa8sDYOXRP2zIgwn%2B7iBLjcSUJeznEFIpVPfwsRb3qkPn7X1blHjx85wY3eq6MZLw4o9%2BeN1P9iTzlECcIm6lAsjg%3D%3D--83cB38amDA8vygui--GrteO%2Bp695Ddw30jnvCiNw%3D%3D',
  'eas-client-id': '5438EE07-922D-43BE-922D-1B594311B934',
  'expo-accept-signature': 'false',
  'expo-api-version': '1',
  'expo-current-update-id': '46144ffd-e85b-4621-b206-e5ef45ffcab2',
  'expo-embedded-update-id': '46144ffd-e85b-4621-b206-e5ef45ffcab2',
  'expo-expect-signature': 'sig, keyid="main", alg="rsa-v1_5-sha256"',
  'expo-json-error': 'true',
  'expo-platform': 'ios',
  'expo-release-channel': 'default',
  'expo-runtime-version': '1',
  'expo-updates-environment': 'BARE',
  'user-agent': 'HelloTest/1 CFNetwork/1402.0.8 Darwin/22.1.0',
  'x-country': 'ES',
  'x-forwarded-for': '62.118.155.55, 101.62.0.225',
  'x-forwarded-proto': 'https',
  'x-language': 'en-US',
  'x-nf-client-connection-ip': '62.118.155.55',
  'x-nf-request-id': '01GMXNF4349FFDC1FEEYZA83MP',
  connection: 'close'
}

Thanks for any help/assistance you could provide 👍

RomeHein commented 1 year ago

Ok I found the issue. It was coming from the getMetadataSync function in the helper file:

createdAt: new Date(metadataStat.birthtime).toISOString(),

Somehow on Netlify the birthtime of the metadata file isn't right and return 1970 date. This issue took me 3 days to debug. I wish expo had better logs instead of just logging "error: noUpdateAvailable"

munawarkholil commented 8 months ago

how to solve

Ok I found the issue. It was coming from the getMetadataSync function in the helper file:

createdAt: new Date(metadataStat.birthtime).toISOString(),

Somehow on Netlify the birthtime of the metadata file isn't right and return 1970 date. This issue took me 3 days to debug. I wish expo had better logs instead of just logging "error: noUpdateAvailable"

how to fix that error bro?