aws / aws-iot-device-sdk-js-v2

Next generation AWS IoT Client SDK for Node.js using the AWS Common Runtime
Apache License 2.0
220 stars 99 forks source link

aws-iot-device-sdk-js-v2 does not seem to work on Raspberry Pi Zero W #131

Closed markusl closed 3 years ago

markusl commented 3 years ago

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug

As an AWS IoT user, I would expect the IoT SDK to work on one of the most common commercial IoT devices. The IoT SDK v1 works just fine.

SDK version number

Platform/OS/Hardware/Device

Raspberry Pi Zero W.

To Reproduce (observed behavior)

Running the sample application produces an error with NodeJs 14.15.2 from https://unofficial-builds.nodejs.org/

pi@raspberrypi:~/aws-iot-device-sdk-js-v2/samples/node/pub_sub $ node dist/index.js --endpoint xxxxx-ats.iot.eu-west-1.amazonaws.com --root-ca AmazonRootCA1.pem --cert RaspberryPiZeroW.cert.pem --key RaspberryPiZeroW.public.key 
/home/pi/aws-iot-device-sdk-js-v2/node_modules/aws-crt/dist/native/binding.js:60
    throw new Error("AWS CRT binary not present in any of the following locations:\n\t" + search_paths.join('\n\t'));
    ^

Error: AWS CRT binary not present in any of the following locations:
        /home/pi/aws-iot-device-sdk-js-v2/node_modules/aws-crt/dist/bin/native/aws-crt-nodejs
        /home/pi/aws-iot-device-sdk-js-v2/node_modules/aws-crt/dist/bin/linux-arm/aws-crt-nodejs

Expected behavior

I would expect the IoT device SDK to work as the previous version did.

Logs/output If applicable, add logs or error output.

REMEMBER TO SANITIZE YOUR PERSONAL INFO

const level : io.LogLevel = parseInt(io.LogLevel[argv.verbosity.toUpperCase()]);
io.enable_logging(level);

Additional context

See previous discussion at https://github.com/aws/aws-iot-device-sdk-js-v2/issues/119.

jmklix commented 3 years ago

As stated in the previous issue I have been able to run the latest version of this sdk on my raspberry pi zero w which I confirmed by deleting and reinstalling. Can you try installing AWS common runtime with the following: npm install aws-crt And let me know if that works for you?

markusl commented 3 years ago

@jmklix thanks for your comment! I'm still wondering what you did differently with RaspPiZero W than what I am encountering. Installing aws-crt does not work either:

~/aws-iot-device-sdk-js-v2/samples/node/pub_sub $ npm install aws-crt
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported

> aws-crt@1.3.8 install /home/pi/aws-iot-device-sdk-js-v2/samples/node/pub_sub/node_modules/aws-crt
> node ./scripts/install.js

info TOOL Using Unix Makefiles generator.
info TOOL Building only the install target, as specified from the command line.
ERR! OMG CMake executable is not found. Please use your system's package manager to install it, or you can get installers from there: http://cmake.org.
(node:22207) UnhandledPromiseRejectionWarning: Error: CMake executable is not found. Please use your system's package manager to install it, or you can get installers from there: http://cmake.org.
    at CMake.verifyIfAvailable (/home/pi/aws-iot-device-sdk-js-v2/samples/node/pub_sub/node_modules/cmake-js/lib/cMake.js:115:15)
    at CMake.build (/home/pi/aws-iot-device-sdk-js-v2/samples/node/pub_sub/node_modules/cmake-js/lib/cMake.js:287:10)
    at BuildSystem._invokeCMake (/home/pi/aws-iot-device-sdk-js-v2/samples/node/pub_sub/node_modules/cmake-js/lib/buildSystem.js:59:40)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:22207) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:22207) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
+ aws-crt@1.3.8
added 214 packages from 157 contributors and audited 458 packages in 693.246s

9 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Do you have the aws-crt-nodejs binaries somewhere on our system and how did you get them there?

jmklix commented 3 years ago

@markusl do you have cmake installed?

I did a fresh install on my raspberry pi zero w to make sure it wasn't something I already had installed. I got it running with the only issue being your node install script wasn't running correctly and the path wasn't getting set. I got around this by just running the commands in a temp dir and that worked fine. If you do have cmake installed list what version you are using?

markusl commented 3 years ago

@jmklix after installing CMake the library compilation failed due to the next dependency which was some SSL library IIRC. I can check this later.

Could you explain where do you have the aws-crt-nodejs binary and how did you get it in there? Do you have it under node_modules/aws-crt/dist/bin/linux-arm/aws-crt-nodejs? Is it build for ARM ARMv6 and who provided that build?

jmklix commented 3 years ago

Yes, I have it here: aws-iot-device-sdk-js-v2/node_modules/aws-crt/dist/bin/linux-arm/aws-crt-nodejs.node It was put there when I ran the first npm install as specified on the previous github issue. This should include the build for

ARMv6. Are you getting the same error as before with aws-crt-nodejs? Also I noticed I had to re-add node v14.15.2 to the path, because at some point it was removed.

github-actions[bot] commented 3 years ago

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.