logto-io / logto

🧑‍🚀 The better identity infrastructure for developers and the open-source alternative to Auth0.
https://logto.io
Mozilla Public License 2.0
8.5k stars 419 forks source link

bug: ReferenceError: crypto is not defined in generators.js #6117

Open arjun-iihglobal opened 3 months ago

arjun-iihglobal commented 3 months ago

Describe the bug

I am getting a ReferenceError: crypto is not defined. The file reference is @logto/node/lib/edge/generators.

And I am using Node js v18.20.3

Expected behavior

Just import the crypto in @logto/node/lib/edge/generators

How to reproduce?

Just install the @logto/express with node 18 version and use import { handleAuthRoutes } from "@logto/express";

Context

Screenshots

image

image

darcyYe commented 3 months ago

Would you like to double check whether your @logto/express SDK is updated? Seems I can not find import crypto from 'crypto'; in our latest @logto/node/edge/generators.ts file.

arjun-iihglobal commented 3 months ago

image

Yes I am using latest @logto/express npm package

and you can see there is no import of crypto image

charIeszhao commented 3 months ago

The crypto API are available on node 20, I'm afraid.

arjun-iihglobal commented 3 months ago

Yes, It is working on node 20. I have tested this.

vacijj commented 1 week ago

See also https://github.com/logto-io/js/issues/784#issuecomment-2365033962