Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENOENT: no such file or directory, open '/var/task/node_modules/security-context/contexts/security-v1.jsonld #122

Open
OR13 opened this issue Oct 31, 2021 · 2 comments

Comments

@OR13
Copy link
Collaborator

OR13 commented Oct 31, 2021

2021-10-31T17:37:11.535Z	5180479b-60c6-4715-9a89-4ae3d59f27ad	ERROR	/var/task/node_modules/security-context/js/index.js:1
Error: ENOENT: no such file or directory, open '/var/task/node_modules/security-context/contexts/security-v1.jsonld'
    at Object.openSync (fs.js:498:3)
    at Proxy.readFileSync (fs.js:394:35)
    at _read (/var/task/node_modules/security-context/js/index.js:12:8)
    at Object.<anonymous> (/var/task/node_modules/security-context/js/index.js:19:3)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/var/task/node_modules/security-context/contexts/security-v1.jsonld'
}
RequestId: 5180479b-60c6-4715-9a89-4ae3d59f27ad Error: Runtime exited with error: exit status 1
Runtime.ExitError

Probably caused by the use of fs and path here: https://github.com/w3c-ccg/security-vocab/blob/main/js/index.js

It would be wiser to use require, or import instead of fs.

This prevents these libraries from working in environments where the fs / modules may not be accessible, such as cloud functions on vercel / next.js or React Native....

In turn this error causes failures in any other dependencies that rely of security context.

@OR13
Copy link
Collaborator Author

OR13 commented Nov 1, 2021

My hope was to use digital bazaar libraries here: https://github.com/transmute-industries/api.did.actor/tree/main/vc-api/facade

So we could test did key and vc based interop with a toggle for selecting the vendor, but I cannot get the db libraries to run on vercel...

here is our solution to the same issue:

https://github.com/transmute-industries/verifiable-data/blob/main/packages/security-context/index.js#L4

we use require, and .json instead of .jsonld.

@dmitrizagidulin
Copy link

It would be wiser to use require, or import instead of fs.

+1, this is why I had to create a fork of this lib here: https://github.com/digitalbazaar/security-context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants