aws-iot-device-sdk-js-v2: Error: AWS CRT binary not present in any of the following locations on Nextjs app running npm run dev

Describe the bug

I facing an issue while installing the aws-iot-device-sdk-v2 package. After importing iot and mqtt, I attempt to run the Next.js app using npm run dev but encounter the below errors

Error: AWS CRT binary not present in any of the following locations:
        /bin/darwin-arm64-cruntime/aws-crt-nodejs.node
    at eval (webpack-internal:///./node_modules/aws-crt/dist/native/binding.js:110:11)
    
- error node_modules/aws-crt/dist/native/binding.js (109:0) @ eval
- error Error: AWS CRT binary not present in any of the following locations:
        /bin/darwin-arm64-cruntime/aws-crt-nodejs.node
    at eval (webpack-internal:///./node_modules/aws-crt/dist/native/binding.js:110:11)

Expected Behavior

After importing iot and 'mqttfromaws-iot-device-sdk-v2` the nextjs app running as we expect normally

Current Behavior

Currently, it’s throwing the below error we can import { it, mqtt } from 'aws-iot-device-sdk-v2' on the Nextjs app component and run on it.

Error: AWS CRT binary not present in any of the following locations:
        /bin/darwin-arm64-cruntime/aws-crt-nodejs.node
    at eval (webpack-internal:///./node_modules/aws-crt/dist/native/binding.js:110:11)
    
- error node_modules/aws-crt/dist/native/binding.js (109:0) @ eval
- error Error: AWS CRT binary not present in any of the following locations:
        /bin/darwin-arm64-cruntime/aws-crt-nodejs.node
    at eval (webpack-internal:///./node_modules/aws-crt/dist/native/binding.js:110:11)

Reproduction Steps

  1. Install aws-iot-device-sdk-v2 on the Nextjs app.
  2. import iot and mqtt from 'aws-iot-device-sdk-v2 and iot and mqtt APIs are used on the Nextjs app component.
  3. run npm run dev on terminal
  4. the above-mentioned mention error throwing on the terminal

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.19.5

Environment details (OS name and version, etc.)

| Environment | version | | macOS | 14.4.1 | | processer | m1 chip | | node 20.12.1 | | nextjs | 13.4.7 |

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

I made several attempts to fix the issue following the suggestions mentioned in module-federation, but unfortunately, I wasn’t able to resolve it. Currently, I don’t have a viable solution for this problem. I’ll leave the issue open in case anyone has further updates or suggestions.

It seems like the issue more related to a webpack configuration rather than a problem with our SDK. I’m not positive if we would have a good solution for it. Unfortunately, I’m a bit short to dive deeper into it right now. I’ll be able to revisit the issue in two weeks.