cloudevents-generator
cloudevents-generator copied to clipboard
uuid v4 cannot
I used the example to generate node.js lib with http bind as below.
cloudevents-generator generate --input ce.yaml --output lib --language nodejs --binding HTTP
When I tried to use the lib, there was an error.
$ functions-framework --target=helloCloudEvents --signature-type=event --port=8081
Provided module can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports" in /home/littlefox/works/serverless/kogito/serverless-workflow-hello-world/openfunction/hello/node_modules/uuid/package.json
at new NodeError (internal/errors.js:322:7)
at throwExportsNotFound (internal/modules/esm/resolve.js:332:9)
at packageExportsResolve (internal/modules/esm/resolve.js:565:3)
at resolveExports (internal/modules/cjs/loader.js:450:36)
at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at Object.<anonymous> (/home/littlefox/works/serverless/kogito/serverless-workflow-hello-world/openfunction/hello/lib/mypackage/Basic/Basic.js:1:16)
Could not load the function, shutting down.
error Command failed with exit code 1.
Then I updated the generated code from const uuidv4 = require('uuid/v4');
to const uuidv4 = require('uuid');
, the error was fixed.
My dev environment is here
$ node -v
v14.21.2
$ npm -v
6.14.17