PeculiarVentures / asn1-schema

asn1-schema is a collection of TypeScript schemas that make working with common ASN.1 objects easy
34 stars 11 forks source link

Error: Cannot get schema for 'ObjectIdentifier' target #90

Open dchocoboo opened 1 year ago

dchocoboo commented 1 year ago

/node_modules/@peculiar/asn1-schema/build/cjs/schema.js:1 Error: Cannot get schema for 'ObjectIdentifier' target

  at AsnSchemaStorage.get (node_modules/@peculiar/asn1-schema/build/cjs/schema.js:17:19)
  at Function.toASN (node_modules/@peculiar/asn1-schema/build/cjs/serializer.js:24:48)
  at Function.serialize (node_modules/@peculiar/asn1-schema/build/cjs/serializer.js:14:21)
  at Function.serialize (node_modules/@peculiar/asn1-schema/build/cjs/convert.js:10:43)
  at Function.register (node_modules/webcrypto-core/build/webcrypto-core.js:1144:43)
  at Object.<anonymous> (node_modules/webcrypto-core/build/webcrypto-core.js:1170:10)
  at Object.<anonymous> (node_modules/@peculiar/webcrypto/build/webcrypto.js:7:12)
      at Object.<anonymous> (/node_modules/isomorphic-webcrypto/src/index.js:1)
      at Object.<anonymous> (/node_modules/isomorphic-webcrypto/src/main.js:1)
      at Object.<anonymous> (/node_modules/@pathcheck/dcc-sdk/lib/cose-js/sign.js:1)
      at Object.<anonymous> (/node_modules/@pathcheck/dcc-sdk/lib/dcc.js:1)
      at Object.<anonymous> (/node_modules/@pathcheck/dcc-sdk/lib/main.js:1)
dchocoboo commented 1 year ago

dependencies version : 2.3.3

microshine commented 1 year ago

Please check that you have only one instance of @peculiar/asn1-schema in your project. If it is not, deduplicate it.

npm list @peculiar/asn1-schema
micwallace commented 1 year ago

This same issue happens to me if i npm link to a library using asn1-schema. Might be something related to the symlinks used.

microshine commented 2 months ago

This error occurs because the @peculiar/asn1-schema module registers schemas at the module variable level. If your project includes multiple versions of this module, the schemas might be registered in different instances, leading to this error.