-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
I try to test provided examples with following code, it's wrapped with expressjs endpoint, also following wwdc2023 tutorial:
router.get('/test', async (req: Request, res: Response) => {
try {
const encodedKey = await readFile(
`${kpiDir}/SubscriptionKey_F7M89F44D8_first.p8`,
'utf8'
)
const client = new AppStoreServerAPIClient(
encodedKey,
Config.APPLE_KEY_ID,
Config.APPLE_ISSUER_ID,
Config.APPLE_BUNDLE_ID,
environment
)
const testNotificationResponse = await client.requestTestNotification()
const testNotificationResponseStatus =
await client.getTestNotificationStatus(
testNotificationResponse.testNotificationToken
)
console.log(
`SendTestNotificationResponse response: ${JSON.stringify(testNotificationResponseStatus)}`
)
console.log(
`SendTestNotificationResponse: ${testNotificationResponseStatus.signedPayload.substring(0, 20)}`
)
} catch (e) {
console.error(e)
}
res.sendStatus(200)
})But get this error, every time no matter if environment is SANDBOX or PRODUCTION:
APIException [Error]
at AppStoreServerAPIClient.makeRequest (/app/node_modules/@apple/app-store-server-library/index.ts:167:23)
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at async AppStoreServerAPIClient.getTestNotificationStatus (/app/node_modules/@apple/app-store-server-library/index.ts:271:16) {
httpStatusCode: 404,
apiError: 4040008,
errorMessage: 'The test notification token is expired or the notification and status are not yet available.'
}Is testing endpoint is disabled, or something is missing?
Metadata
Metadata
Assignees
Labels
No labels