We use Bitrise for our build pipelines and the step for building and signing the iOS app fails when calling the v1/devices
endpoint. Specifically, the next endpoint from the App Store API returns this error when getting the next page of devices.
PARAMETER_ERROR.INVALID: A parameter has an invalid value: 'XXXXXXXXXXXXX' is not a valid cursor for this request
I am able to recreate this in Postman. The first query without a cursor works just fine.
https://api.appstoreconnect.apple.com/v1/devices?filter%5Bplatform%5D=IOS&filter%5Bstatus%5D=ENABLED&limit=20 { data: [ ... ], "links": { "self": "https://api.appstoreconnect.apple.com/v1/devices?filter%5Bstatus%5D=ENABLED&filter%5Bplatform%5D=IOS&limit=20", "next": "https://api.appstoreconnect.apple.com/v1/devices?filter%5Bstatus%5D=ENABLED&filter%5Bplatform%5D=IOS&cursor=XXXXXXXXXXXX&limit=20" }, "meta": { "paging": { "total": 90, "limit": 20 } } }
However when I try to get the next page of devices with the next URL from the App Store API I get the same error as before.
{ "errors": [ { "id": "...", "status": "400", "code": "PARAMETER_ERROR.INVALID", "title": "A parameter has an invalid value", "detail": "'XXXXXX' is not a valid cursor for this request", "source": { "parameter": "cursor" } } ] }
Recently I refreshed the certificates and provisioning profiles and removed outdated device listings, so this might play a role in what is happening.
After spending some hours to resolve this issue, I was able to make it working again in the Bitrise. I noticed that they mark the existing Apple code signing in each project as legacy and recommend managing it in the workspace settings.
After adding my App Store Connect API key there, it started working again with ad-hoc distribution. In my case, I created a new API key, however I hope this helps other devs.