starbladeS
Denoβ€’2y agoβ€’
5 replies
starblade

Problems using @apple/app-store-server-library, how do I debug?

Hi,

I'm attempting to build out the backend of an IOS app on Supabase and want to be able to verify the purchase of in-app purchases using an edge function. I have a block of code working perfectly in nodejs on my local machine i.e.,

import { AppStoreServerAPIClient, Environment, SignedDataVerifier } from "@apple/app-store-server-library";


When I go to use this library inside of an edge function I'm getting errors pop up inside of dependencies of the app-store-server-library module.

I've tried the import using the npm: prefix like so
import pkg from "npm:@apple/app-store-server-library";
const { AppStoreServerAPIClient, Environment, SignedDataVerifier } = pkg;

And when i attempt to run my code I get this error
Error getting transaction history Error: "alg" parameter "ES256" requires curve "prime256v1".
    at module.exports (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/jsonwebtoken/9.0.2/lib/validateAsymmetricKey.js:46:15)
    at module.exports [as sign] (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/jsonwebtoken/9.0.2/sign.js:179:7)
    at AppStoreServerAPIClient.createBearerToken (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/@apple/app-store-server-library/1.0.1/dist/index.js:323:29)
    at AppStoreServerAPIClient.makeRequest (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/@apple/app-store-server-library/1.0.1/dist/index.js:93:47)
    at AppStoreServerAPIClient.getTransactionInfo (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/@apple/app-store-server-library/1.0.1/dist/index.js:285:27)
    at getTransactionInformation (file:///home/deno/functions/_shared/apple-helpers.ts:49:31)
    at eventLoopTick (ext:core/01_core.js:64:7)
    at async Object.handler (file:///home/deno/functions/apple-pay-test/index.ts:14:16)
    at async handleHttp (ext:sb_core_main_js/js/http.js:102:17)


This is my first time using Deno and I'm feeling a little lost. Any help is appreciated! Thanks
Was this page helpful?