awslabs / aws-crt-nodejs

NodeJS bindings for the AWS Common Runtime.
Apache License 2.0
37 stars 24 forks source link

Fix "Cannot find module" for aws-crt-nodejs #522

Closed ferbs closed 5 months ago

ferbs commented 5 months ago

Description of changes: In lib/native/bindings.js, after successfully finding the aws-crt-nodejs native module, it drops the .node extension when calling require. That should be fine in a pure commonJs environment but dropping the extension breaks some ES-like runtime and build environments.

This PR includes the extension in the require call.

I don't see a test to update. (Consider adding some? There seem to be a lot of regressions in aws-sdk-js-v3 relating to aws-crt and signature-v4-crt. It would take a lot of work around test fixtures but perhaps worthwhile/justified?)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

bretambrose commented 5 months ago

Should be superceded by https://github.com/awslabs/aws-crt-nodejs/pull/490