Azure / azure-kusto-node

JS SDK for the Kusto service
MIT License
53 stars 39 forks source link

7.x-alpha.0 ESM import issue - JSON - ERR_IMPORT_ASSERTION_TYPE_MISSING #325

Closed jeffwilcox closed 2 months ago

jeffwilcox commented 2 months ago

We tried pulling in the alpha package today and at startup our ESM app is not working. Is it possible that the library may need to shift away from JSON-based imports and to use fs+path to read the JSON file at runtime given that JSON imports are a little funky on Node.js right now?

TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///_path to web app dist folder_/node_modules/azure-kusto-data/dist-esm/src/wellKnownKustoEndpoints.json" needs an import attribute of type "json"
    at validateAttributes (node:internal/modules/esm/assert:89:15)
    at defaultLoad (node:internal/modules/esm/load:153:3)
    at async ModuleLoader.load (node:internal/modules/esm/loader:396:7)
    at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:45) {
  code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING'
}

Node.js v20.15.0

 

AsafMah commented 2 months ago

We don't see it in our tests, can you give us more info?

jeffwilcox commented 2 months ago

Unfortunately this looks to be more systemic with Windows + Azure SDK's core-rest-pipeline stuff... going to keep digging in, but it does not impact our prod Linux things or Mac development.

Sorry for the maybe-false-alarm for now...