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.,
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
And when i attempt to run my code I get this error
This is my first time using Deno and I'm feeling a little lost. Any help is appreciated! Thanks5 Replies
I've also tried using
esm.sh
like so:
which results in a different error:
I'm sorry, but I wasn't able to find the answer to your question in the official Deno documentation. However, based on the information you've provided in your message, it seems like you're encountering an issue with the
@apple/app-store-server-library
when trying to use it within an edge function in Deno.
The error message you're seeing suggests that there is a problem with the algorithm parameter "ES256" which requires the curve "prime256v1". This could be related to the cryptographic operations that the library is trying to perform.
While I cannot provide a solution based on the Deno documentation, I can suggest that you ensure that the cryptographic libraries and dependencies used by @apple/app-store-server-library
are compatible with the Deno runtime environment. It's possible that the library or its dependencies might be using Node.js-specific APIs or features that are not available or work differently in Deno.
Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of this advice. Since this is your first time using Deno and you're feeling a bit lost, I would recommend reaching out to the community or the maintainers of the @apple/app-store-server-library
for further assistance, as they might have more experience with this specific library and its compatibility with Deno.🦕 Oops! Can you pinpoint where I went wrong to help me improve? 📈
I'm still working on this and still stuck. I'm now able to reproduce the problem locally using the deno command line utility. I've got it hooked up to a debugger and I've pinpointed the resulting issue but still can't figure out the underlying cause or how to fix it.
In the end some cryptographic named curve is coming back as 'p256' in deno but it comes back as 'prime256v1' in node, which is causing the error to be thrown in the jsonwebtoken library when it attempts to validate the key.
I'm debugging into a file called
ext:deno_node/internal/crypto/keys.ts
The op_node_create_private_key
function is the first instance of the string 'p256' I can see appearing in my program, but I can't step into it.GitHub
deno/ext/node/ops/crypto/mod.rs at c10d96cb21d5f75b4c6f7b7d8d96d12a...
A modern runtime for JavaScript and TypeScript. Contribute to denoland/deno development by creating an account on GitHub.