jimmdd / node-oracle-layers-serverless

starter template created for using oracle db on lambda
https://medium.com/@jimmdd/the-complete-guide-to-use-node-oracledb-on-aws-lambda-using-serverless-framework-and-lambda-layers-52b374d6cfe7
MIT License
16 stars 8 forks source link

NJS-045: cannot load a node-oracledb binary for Node.js 10.16.2 (darwin x64) #2

Closed danielesalvatore closed 5 years ago

danielesalvatore commented 5 years ago

Hi @jimmdd ! Thank you very much for your work!

I am currently struggling making node-oracledb to work on my

Please find below the error I get while i make run the serverless-offline locally:

Error: NJS-045: cannot load a node-oracledb binary for Node.js 10.16.2 (darwin x64)
  Looked for /build/Release/oracledb-abi64-darwin-x64.node, /build/Release/oracledb.node, /build/Debug/oracledb.node
  Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html

    at Object.eval (webpack:///./node_modules/oracledb/lib/oracledb.js?:55:13)
    at eval (webpack:///./node_modules/oracledb/lib/oracledb.js?:648:30)
    at Object../node_modules/oracledb/lib/oracledb.js (/Users/danielesalvatore/Desktop/node-oracle-layers-serverless-ma

Content of ~/lib: (tried to alter permission to be 777 to exclude file system permission problems)

danielesalvatore@Danieles-iMac lib $ ll -al
total 474984
drwxrwxrwx  21 danielesalvatore  staff        672 Aug  9 14:27 .
drwxrwxrwx   4 root              wheel        128 Aug  9 14:15 ..
-rwxrwxrwx@  1 danielesalvatore  staff       6148 Aug  9 14:16 .DS_Store
-rwxrwxrwx@  1 danielesalvatore  staff       1354 Feb  2  2019 BASIC_README
-rwxrwxrwx@  1 danielesalvatore  staff       9888 Feb  2  2019 adrci
-rwxrwxrwx@  1 danielesalvatore  staff      40448 Feb  2  2019 genezi
lrwxr-xr-x@  1 danielesalvatore  staff         20 Aug  8 17:43 libclntsh.dylib -> libclntsh.dylib.18.1
-rwxrwxrwx@  1 danielesalvatore  staff   94966232 Oct 30  2018 libclntsh.dylib.18.1
-rwxrwxrwx@  1 danielesalvatore  staff    4786360 Oct 30  2018 libclntshcore.dylib.18.1
-rwxrwxrwx@  1 danielesalvatore  staff    8554544 Oct 14  2018 libnnz18.dylib
lrwxr-xr-x@  1 danielesalvatore  staff         18 Aug  8 17:43 libocci.dylib -> libocci.dylib.18.1
-rwxrwxrwx@  1 danielesalvatore  staff    1593632 Oct 30  2018 libocci.dylib.18.1
-rwxrwxrwx@  1 danielesalvatore  staff  126944172 Feb  2  2019 libociei.dylib
-rwxrwxrwx@  1 danielesalvatore  staff     151980 Oct 29  2018 libocijdbc18.dylib
-rwxrwxrwx@  1 danielesalvatore  staff     247244 Oct  8  2018 libons.dylib
-rwxrwxrwx@  1 danielesalvatore  staff     100492 Oct 30  2018 liboramysql18.dylib
drwxrwxrwx   4 danielesalvatore  staff        128 Aug  9 14:15 network
-rwxrwxrwx@  1 danielesalvatore  staff    4161484 Dec  6  2017 ojdbc8.jar
-rwxrwxrwx@  1 danielesalvatore  staff    1366460 Dec  6  2017 ucp.jar
-rwxrwxrwx@  1 danielesalvatore  staff     150080 Feb  2  2019 uidrvci
-rwxrwxrwx@  1 danielesalvatore  staff      74263 Feb  7  2018 xstreams.jar

~/lib in the my $PATH

I followed the Oracle instructions: link

Thank you very much in advance, Daniele

jimmdd commented 5 years ago

Hi, this is not the issue of this project and your problem is because of instant client not install correctly locally I guess. if you running locally, you have to install node-oracledb as dev dependency , I have been using 12.1 and this project is based on 12.1. here is the list of required files for instant client on mine opt/oracle/instantclient_12_2 and ~/lib directory. Please let me know if you are run into any issue that this won't work on lambda. I'll close this for now and hope these information will be helpful. If you are still struggling, I can see if I will have time to test on 18 later next week. but I have no plan to support 18 right now.

image image
danielesalvatore commented 5 years ago

Dear @jimmdd Thank you very much for your prompt reply and support!!

This problem seemed to be related to serverless-webpack or the webpack configuration I used. I removed the plugin and now the binary is loaded correctly.

On Monday, I'll keep troubleshooting this and will post here the solution for future reference.

Thank you again!

jimmdd commented 5 years ago

@danielesalvatore Thanks. The current repo doesn't have webpack configured but I do have other projects with orabledb and webpack. I'll update the repo with it this weekend. Please check back on Monday compare my webpack configs and yours. If my settings are still not working for you, please do a PR if you could to add your webpack settings once you have correct webpack.

jimmdd commented 5 years ago

@danielesalvatore I have updated branch feature/add_webpack, please try it and let me know if that works for you. I've test on my local and everything works. If it's work for you, I'll merge it into master. Please see the following PR: #3

danielesalvatore commented 5 years ago

Hi @jimmdd! I confirm that it works perfectly! Thank you very much for this! Please do not hesitate to contact me in case you need any additional testing!

The only thing I noticed is that you removed the webpack configuration from serverless.yml file, while I kept it in order to exclude from the bundle some other libs, as suggested in the serverless-webpack doc.

Thanks!

jimmdd commented 5 years ago

Hi @jimmdd! I confirm that it works perfectly! Thank you very much for this! Please do not hesitate to contact me in case you need any additional testing!

The only thing I noticed is that you removed the webpack configuration from serverless.yml file, while I kept it in order to exclude from the bundle some other libs, as suggested in the serverless-webpack doc.

Thanks!

OK that custom webpack session is optional. But I'll update the Yaml with the webpack session.