Closed Innei closed 11 months ago
Thanks for reporting this @Innei! There are so many possible hosting setups these days that I have to rely on you all to help work through issues like this one with Vercel.
I'm going to reopen this as a documentation issue - I've got a section in the docs with various issues and workarounds that this would slot nicely into.
@MasterKale Hi, nice work. I think this type of env should not be controlled by the external env because it directly affects the operation of the app. So now I inject this env directly into the runtime, like this.
function nodeEnvInjection() {
// # https://github.com/kriszyp/cbor-x/blob/master/node-index.js#L16 https://github.com/kriszyp/cbor-x/blob/master/node-index.js#L10
// # ncc not support runtime require so disable ACCELERATION
process.env['CBOR_NATIVE_ACCELERATION_DISABLED'] = '1'
}
// And at first of the main entry
nodeEnvInjection()
I've added this to the docs as new troubleshooting guidance:
https://simplewebauthn.dev/docs/packages/server#error-extractstrings-is-not-a-function
Describe the issue
I deploy application to production environment, but there are some error in
verifyRegistrationResponse
Reproduction Steps
This error only causes in prod and using
@vercel/ncc
to bundle.Because https://github.com/kriszyp/cbor-x/blob/master/node-index.js#L16, but ncc not support runtime require, the bundled application can not find this package, so the error thrown.
How to solve
If you are still using ncc to pack, please add
CBOR_NATIVE_ACCELERATION_DISABLED=true
in the env file, to disable the runtime requirehttps://github.com/kriszyp/cbor-x/blob/master/node-index.js#L10