You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know this uses native modules and probably needs to be treated differently; however, I do not have much experience with native modules. I can easily handle layers, but the use case and problem I am facing is that whenever I try to use the EsBuild bundler and either run it locally on Windows 11 or AWS Lambda, I get the following No native build was found for platform error. could someone advise or even confirm if running the package on AWS Lambda is feasible at all?
environment is Node18
The text was updated successfully, but these errors were encountered:
Normally, sodium-native looks for the native library binary in a location relative to sodium-native's "index.js" file by using the __dirname magic variable.
When ESBuild bundles things, it inlines sodium-native's "index.js" into the bundle.
When the bundle runs, __dirname is the folder of the bundle rather than the folder of sodium-native's "index.js", so it can't find the native library binary.
The hack I'm currently using: add --external:sodium-native to the ESBuild command line.
The downside of that hack is that sodium-native's JS code is no longer part of the ESBuild bundle. It will be require'd at runtime, so the bundle is no longer self-contained. You need to include the sodium-native library with your deployment, e.g. in "node_modules".
The ESBuild issue tracker has some examples of how to use an ESBuild plugin to fake out the __dirname magic variable to refer to the location of the original file: evanw/esbuild#859. I haven't tried it out.
I know this uses native modules and probably needs to be treated differently; however, I do not have much experience with native modules. I can easily handle layers, but the use case and problem I am facing is that whenever I try to use the EsBuild bundler and either run it locally on Windows 11 or AWS Lambda, I get the following
No native build was found for platform
error. could someone advise or even confirm if running the package on AWS Lambda is feasible at all?environment is Node18
The text was updated successfully, but these errors were encountered: