asn1-schema icon indicating copy to clipboard operation
asn1-schema copied to clipboard

Cannot get schema for 'DigestInfo' target

Open dhensby opened this issue 3 years ago • 3 comments

When trying to parse an ASN.1 value into a DigestInfo object I get the following error:

Error: Cannot get schema for 'DigestInfo' target
    at AsnSchemaStorage.get (.\node_modules\@peculiar\asn1-schema\build\cjs\schema.js:18:19)
    at Function.fromASN (.\node_modules\@peculiar\asn1-schema\build\cjs\parser.js:39:52)
    at Function.parse (.\node_modules\@peculiar\asn1-schema\build\cjs\parser.js:29:26)
    at Function.parse (.\node_modules\@peculiar\asn1-schema\build\cjs\convert.js:11:35)

Code to reproduce:

const { AsnConvert } = require('@peculiar/asn1-schema');
const { DigestInfo } = require('@peculiar/asn1-rsa');

AsnConvert.parse(Buffer.from(...), DigestInfo);

Sorry for such a basic question, but is there something I'm missing here?

dhensby avatar Apr 28 '21 16:04 dhensby

The problem could be in multiple @peculiar/asn1-schema modules.

Please check out that module

npm list @peculiar/asn1-schema

There must be only one instance of that module

microshine avatar May 10 '21 11:05 microshine

I'm getting this on other models too now

This is the output from that command - it appears that there is only one version / instance of the module.

$ npm list @peculiar/asn1-schema
[email protected] .\my-package
+-- @peculiar/[email protected]
| +-- @peculiar/[email protected]  deduped
| `-- @peculiar/[email protected]
|   `-- @peculiar/[email protected]  deduped
+-- @peculiar/[email protected]
| `-- @peculiar/[email protected]  deduped
+-- @peculiar/[email protected]
| +-- @peculiar/[email protected]
| | `-- @peculiar/[email protected]  deduped
| +-- @peculiar/[email protected]
| | +-- @peculiar/[email protected]
| | | `-- @peculiar/[email protected]  deduped
| | `-- @peculiar/[email protected]  deduped
| +-- @peculiar/[email protected]
| | `-- @peculiar/[email protected]  deduped
| `-- @peculiar/[email protected]  deduped
+-- @peculiar/[email protected]
| +-- @peculiar/[email protected] <-- Aha! looks like this is not deduped for some reason
| `-- @peculiar/[email protected]
|   `-- @peculiar/[email protected]  deduped
+-- @peculiar/[email protected]
`-- @peculiar/[email protected]
  `-- @peculiar/[email protected]  deduped

dhensby avatar May 11 '21 10:05 dhensby

Try to remove node_modules and package-lock.json files and install dependencies

microshine avatar May 11 '21 15:05 microshine

I think this resolved it and part of the problem was we had dependabot upgrading dependencies one-by-one which lead to dependency hell.

We now use grouped dependanbot updates for all @peculiar/* packages and we've not had the problem again.

dhensby avatar Jul 25 '24 10:07 dhensby