I tried to use/import the web-push library (https://github.com/web-push-libs/web-push) for node-js in a deno supabase edge function and it does not work.
- Is it possible to use the mentioned library in this case?
- If not, why is it not possible?
- If yes, how can I make it work?
My code
import * as webPush from "https://dev.jspm.io/web-push"
Deno.serve(async (req) => {
const vapidKeys = {
publicKey: '<The public Key',
privateKey: '<The private Key>',
}
const webpush = webPush;
webpush.setGCMAPIKey('<The GCM API Key>'); // TODO: I think this line times out
webpush.setVapidDetails(
'mailto:[email protected]',
vapidKeys.publicKey,
vapidKeys.privateKey
);
It looks like there are compatibility issues with the crypto libraries. I built the same app in Deno and Node and Deno crashes when processing the private key with the error:
I tried to import web-push using esm with
target=denobut that causes another error related to the implementation ofcrypto.ECDH(unimplemented)I'm surprised nobody's on this.