[Solution included] OTP breaking change after version 1.1.1 (Deployed Jan 5, 2024)
After my project automatically upgraded from [email protected] to [email protected], my project stopped working.
Apparently, some change on hoow node internal packages are served broke the main function of the codebase: generateKey().
Issue happens on this line: https://github.com/pipobscure/otp/blob/0bc5a3818a5ab80198c7cb5e3933397369967b24/lib/otp.ts#L93C6-L93C6
globalThis.crypto.getRandomValues(bytes);
apparently globalThis.crypto is not defined. checking other changes on the app, I found that we should actually be using:
import { getRandomValues } from 'node:crypto';
For those who want a quick work around, just put the fixed version 1.1.0 in package.json and clear the installation.
I have a PR ready to fix this if the maintainers want the help
This is interesting as globalThis.crypto.getRandomValues is defined both in current Chrome as well as current NodeJS.
Can you tel me what environment you are operating in?
I see that v18.5 does not have it.
Any updates?