denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.01k stars 5.39k forks source link

Azure IoT Hub SDK Connection Issue #26987

Open Skeletor11 opened 18 hours ago

Skeletor11 commented 18 hours ago

Version: Deno 2.0.6

I am trying to connect to the Azure IoT Hub SDK (https://www.npmjs.com/package/azure-iot-device-http) and am receiving the error below. Sample code can be found here:

https://github.com/fathym-deno/community-development/blob/main/tests/iot/csvToIot.ts

The line in question is #28 const client: Client = clientFromConnectionString(deviceConnectionString);

When running in debug mode, the line never gets hit before throwing the error, leading me to believe that is has something to do with the module being pulled in on load. Full stack trace below:

Uncaught TypeError TypeError: Cannot convert undefined or null to object at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\typed-array-byte-offset\1.0.2\index.js:32:18) at forEachArray (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\for-each\0.3.3\index.js:12:17) at forEach (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\for-each\0.3.3\index.js:54:9) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\typed-array-byte-offset\1.0.2\index.js:22:2) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\typed-array-byte-offset\1.0.2\index.js:80:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\es-abstract\1.23.3\2024\IsTypedArrayOutOfBounds.js:11:28) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\es-abstract\1.23.3\2024\IsTypedArrayOutOfBounds.js:56:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\es-abstract\1.23.3\2024\TypedArrayCreateFromConstructor.js:8:31) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\es-abstract\1.23.3\2024\TypedArrayCreateFromConstructor.js:54:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\es-abstract\1.23.3\2024\TypedArraySpeciesCreate.js:11:39) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\es-abstract\1.23.3\2024\TypedArraySpeciesCreate.js:39:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\typedarray.prototype.slice\1.0.3\implementation.js:16:31) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\typedarray.prototype.slice\1.0.3\implementation.js:94:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\typedarray.prototype.slice\1.0.3\index.js:6:22) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\typedarray.prototype.slice\1.0.3\index.js:20:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\traverse\0.6.10\index.js:4:15) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\traverse\0.6.10\index.js:393:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\azure-iot-device\1.18.3\dist\twin.js:8:18) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\azure-iot-device\1.18.3\dist\twin.js:207:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\azure-iot-device\1.18.3\dist\internal_client.js:15:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\azure-iot-device\1.18.3\dist\internal_client.js:396:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\azure-iot-device\1.18.3\dist\device_client.js:10:27) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\azure-iot-device\1.18.3\dist\device_client.js:319:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\azure-iot-device\1.18.3\device.js:47:11) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\azure-iot-device\1.18.3\device.js:64:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\azure-iot-device-http\1.14.3\index.js:6:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\azure-iot-device-http\1.14.3\index.js:23:4) at Module._compile (/module:736:34) at Module._extensions..js (/module:757:11) at Module.load (/module:655:32) at Module._load (/module:523:13) at Module.require (/module:674:19) at require (/module:801:16) at (c:\Users\kevin\AppData\Local\deno\npm\registry.npmjs.org\azure-iot-device-http\1.14.3\index.js:3:13)

dsherret commented 18 hours ago

Try running with --unstable-unsafe-proto https://docs.deno.com/runtime/reference/cli/unstable_flags/#--unstable-unsafe-proto

dsherret commented 18 hours ago

I opened https://github.com/inspect-js/typed-array-byte-offset/issues/3

https://github.com/inspect-js/typed-array-byte-offset/issues/4

dsherret commented 18 hours ago

For some reason the has-proto package returns true for Deno https://github.com/inspect-js/has-proto/blob/main/index.js

Edit: I think it's because this only checks for if __proto__ is allowed for object creation and not after the fact.