Open hapaxlife opened 2 years ago
Same thing for me
I cannot hash user passwords server side for now
Gonna look for this synchronous version by then
Deno namespace is available in workers by default see https://deno.com/blog/v1.22
But we still have
ReferenceError: Worker is not defined
at Module.hash (https://deno.land/x/bcrypt@v0.3.0/src/main.ts:11:18)
However Deno tell us about worker in their blog
// This worker did NOT have access to the `Deno` namespace.
new Worker(new URL("./worker_without_deno.js", import.meta.url));
// This worker did have access to the `Deno` namespace.
new Worker(new URL("./worker_without_deno.js", import.meta.url), {
deno: true,
});
@hapaxlife I think the source of the confusion is that Deno Deploy does not support all of the APIs that Deno supports. I also ran into this and it took me a while to understand until I found the relevant documentation page.
This Deploy Docs API Reference page states:
Deno Deploy Runtime helps you write web servers in TypeScript/JavaScript using the Web APIs. It's different from Deno but aims to have similar APIs where applicable.
The following Web and Deno APIs are supported on Deno Deploy Runtime.
The Worker API is not listed, so it's not supported. I created an issue to improve the docs in that regard.
Closed as fixed? Or because OP doesn't need it any more? Assuming workers still aren't supported, I think there should be an open tracking issue for this (unless it's wontfix forever)
We get
when using a Worker
The following code is not working on Deno Deploy but working with Deno