You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since version 3.7.4, Hono now includes /// <reference lib="webworker" /> in its output. (reference: e326208)
This is incompatible with Cloudflare Workers, since webworker defines crypto and other things with additional methods (see https://workers-types.pages.dev/#SubtleCrypto for example), and loading webworker types completely overrides these.
crypto is now overridden by webworker types, meaning the crypto.subtle.timingSafeEqual method doesn't exist, and I get an error like so:
src/index.ts:8:19 - error TS2339: Property 'timingSafeEqual' does not exist on type 'SubtleCrypto'.
8 if(crypto.subtle.timingSafeEqual(text1, text2)) {
What is the expected behavior?
webworker types should not be loaded in the case of cloudflare workers. The docs at https://www.npmjs.com/package/@cloudflare/workers-types call this out explicitly, since it has incompatibilities with Cloudflare Workers.
Additional information
Can we please get this rolled back or fixed? There are going to be so many other incompatibilities with loading webworker types in a Cloudflare Workers project - this is just one example.
The text was updated successfully, but these errors were encountered:
What version of Hono are you using?
3.7.4
What runtime/platform is your app running on?
Cloudflare Workers
What steps can reproduce the bug?
Since version 3.7.4, Hono now includes
/// <reference lib="webworker" />
in its output. (reference: e326208)This is incompatible with Cloudflare Workers, since
webworker
definescrypto
and other things with additional methods (see https://workers-types.pages.dev/#SubtleCrypto for example), and loadingwebworker
types completely overrides these.For example:
(using tsconfig setup as defined at https://www.npmjs.com/package/@cloudflare/workers-types).
This works fine, and
crypto.subtle.timingSafeEqual
exists as expected.The second that I import something from Hono though, like this:
crypto
is now overridden bywebworker
types, meaning thecrypto.subtle.timingSafeEqual
method doesn't exist, and I get an error like so:What is the expected behavior?
webworker
types should not be loaded in the case of cloudflare workers. The docs at https://www.npmjs.com/package/@cloudflare/workers-types call this out explicitly, since it has incompatibilities with Cloudflare Workers.Additional information
Can we please get this rolled back or fixed? There are going to be so many other incompatibilities with loading
webworker
types in a Cloudflare Workers project - this is just one example.The text was updated successfully, but these errors were encountered: