#kevalmandalik
1 messages · Page 1 of 1 (latest)
Hello kevalmandalik, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
• kevalmandalik, 5 days ago, 8 messages
• kevalmandalik, 6 days ago, 26 messages
• kevalmandalik, 6 days ago, 9 messages
hello! can you share the full stacktrace and which line of code specifically is resulting in this error?
yeah sure
@minor crater here's my frontend code
in frontend i am using reactjs with type script and in backend i am using wrangler
exact line which is causing error is one in try block
@minor crater
this error i am receiving
@minor crater
I'm juggling a number of questions at the moment, so it may take a while longer for me to look into this. Sorry about the wait
Hi @urban spear did you use SubtleCryptoProvider anywhere in your code?
no i haven't used in my code may be it is using from internal library
i am blocked due to this for 5 long day and my project delivery also get delayed so can you plz help me
https://github.com/stripe/stripe-node/blob/0e1ea9f7/src/crypto/SubtleCryptoProvider.ts#L1 are you using Stripe node.js SDK?
Can you check your package.json file and confirm if you are not using stripe-node, or any pacakge that have dependency on stripe-node?
here's list of dependency i am using
You are using stripe-node. see the second last dependency
I'd suggest you to check your usage of stripe-node SDK, and see which one could trigger SubtleCryptoProvider
should i install crypto npm package?
@winged salmon i found out stripe.webhooks.signature.verifyHeader(payload, signature, appSecret);
in above line is goes to
Ok, how did you impememnt the webhook verification?
try{
await stripe.webhooks.signature.verifyHeader(payload, signature, appSecret);
}catch(e:any){
console.log(e);
return new Response(${JSON.stringify({ "message": e.message, "success": false })}, {
status: 400, headers: {
"content-type": "application/json",
"Access-Control-Allow-Origin": "*"
}
});
}
this way
Is this part of code running in a synchronous context?
i have used async await how it can we synchronous
remove the await
Error: SubtleCryptoProvider cannot be used in a synchronous context.
at SubtleCryptoProvider.computeHMACSignature (worker.js:2062:15)
at Object.verifyHeader (worker.js:8903:52)
at worker.js:10358:37
at async Object.handle (worker.js:9375:29)
at async jsonError (worker.js:11559:12) {
stack: Error: SubtleCryptoProvider cannot be used in a sy…5:29)
at async jsonError (worker.js:11559:12),
message: SubtleCryptoProvider cannot be used in a synchronous context.
}
[mf:inf] POST /api/v1/salesforce/submission-list 400 Bad Request (3190ms)
this is recent most error i got in console
Have you removed the await?
yeah ofcourse
I saw a async jsonError, can you check again and make sure the worker.js is not in synchronous context?
you can check here code snippet of worker js
There's still a async, isn't it?
actual error is SubtleCryptoProvider cannot be used in a synchronous context
so i have to use async/await to make asynchronous manner
I don't think that's the right way to interpret the message. My understand is that you need to use in async context, and using await will make the execution synchrnous.
@winged salmon i found out something wrong in method implementation
kindly confirm verifyHeader every time calling computeHMACSignature(payload, signature) method and in implementation it's only throwing error
@obsidian mesa is this right way to implement method
@urban spear that's intentional as it's not supposed to run synchronously.