Unable to upload Game Center Achievement Image using API

I attempted to use the new App Store Connect API 3.0 feature to manage Game Center achievements. My goal was to create a bunch of achievements, with one en-US localization each, with an attached image.

Creating the achievement and its localization initially seems to have worked fine; I uploaded the image, and its assetDeliveryState.state is COMPLETED. But when I visit the achievement in the App Store Connect Console UI, all the images I've uploaded are 404 Not Found. I'm going to have to upload all of these images by hand. 😭

Here's the sample code I used, using the https://github.com/dfabulich/node-app-store-connect-api v5.0.3.

import { api } from 'node-app-store-connect-api';
import { readFile, stat } from 'node:fs/promises';
import { homedir } from 'node:os';

const appId = 6468677114;

const vendorIdentifier = 'com.example.myachievement';
const showBeforeEarend = true;
const points = 10;

const locale = "en-US";
const title = "My Achievement";
const afterEarnedDescription = "Earned the achievment.";
const beforeEarnedDescription = "Earn the achievement.";

const fileName = `${vendorIdentifier}.png`;

const params = {
    issuerId: "69a6de6f-0d6d-47e3-e053-5b8c7c11a4d1",
    apiKey: "3S3G8T48YW",
};

params.privateKey = await readFile(`${homedir()}/.appstoreconnect/private_keys/AuthKey_${params.apiKey}.p8`, 'utf8');

const { read, create, uploadAsset, pollForUploadSuccess } = await api(params);

const {data: gameCenterDetail} = await read(`apps/${appId}/gameCenterDetail`);

console.log('creating', vendorIdentifier);
const gameCenterAchievement = await create({
    type: 'gameCenterAchievements',
    attributes: {
        referenceName: title,
        vendorIdentifier,
        points,
        repeatable: false,
        showBeforeEarned,
    },
    relationships: { gameCenterDetail }
});
console.log('  localization');
const gameCenterAchievementLocalization = await create({
    type: 'gameCenterAchievementLocalizations',
    attributes: {
        locale,
        name: title,
        afterEarnedDescription,
        beforeEarnedDescription,
    },
    relationships: { gameCenterAchievement }
});
console.log('  image');
const image = await create({
    type: 'gameCenterAchievementImages',
    attributes: {
        fileName,
        fileSize: (await stat(fileName)).size,
    },
    relationships: {
        gameCenterAchievementLocalization
    }
});
console.log('  upload');
await uploadAsset(image, await readFile(fileName));
console.log('  poll');
await pollForUploadSuccess(image.links.self);

Filed as FB13343796

I'm having the same issue. In my case I'm using python.

The images are reported to be received properly:

  • the imageAsset width and height are correctly identified as 512 pixels
  • the assetDeilveryState state is UPLOAD_COMPLETE

Comparing the image URLs generated if I manually upload the image via App Store Connect web page and via the API the only notable difference is that

  • manual upload images have "Purple" in the path (eg. https://a2.mzstatic.com/us/r30/Purple116/v4/...)
  • API uploads have "PurpleSource" in the path (eg. https://a4.mzstatic.com/us/r30/PurpleSource126/v4/...)

If you open the API uploaded image in the browser you get the following error: "Unknown pool: PurpleSource116"

So I'm guessing there is something broken in the server side.

@dfabulich it would be great if you could add this to your feedback request. I'm trying to contact Apple with this.

Filed as 13352840

I can confirm that the image is proplery uploaded because if I use the templateURL provided in the gameCenterAchievementImage query, it downloads and displays properly. So image upload is working. It seems that the error is on the App Store Connect webapp side (it does not recognize the PurpleSource pool?).

@dfabulich When checking image URL provided in imageAsset.templateURL make sure you replace the {w} {h} and {f} parts with the width, size and extension of the fille (png).

I can also confirm that the images uploded via de API are shown properly inside the Game Center overlay in the game. So images are properly uploaded. All points to the App Store Connect website having an issue with "PurpleSource" pool.

Unable to upload Game Center Achievement Image using API
 
 
Q