You migrated an existing nodeJS app to another stack and you noticed the app fails to start due to shared libraries. Shared objects libraries can not be vendored.
In the following example, a nodeJS app using a vendored puppeteer library but the putppeteer library is dependent on libnns3.so lib. This results in the following error:
2021-09-16T12:09:55.552-04:00 [APP/PROC/WEB/0] [ERR] 2021-09-16 16:09:55.552+0000 org{am_dt} ERROR [APP_NAME=nodejs-sample-app, APP_VERSION=d73499f3-3544-4dd8-88f0-37107ba77bdd, APP_URL=nodejs-sample-app.example.com,MY_SPACE=dev, INSTANCE_ID=0] MESSAGE=[Error: Failed to launch chrome!
2021-09-16T12:09:55.552-04:00 [APP/PROC/WEB/0] [ERR] chrome/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory 2021-09-16T12:09:55.552-04:00 [APP/PROC/WEB/0] [ERR] TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
2021-09-16T12:09:55.552-04:00 [APP/PROC/WEB/0] [ERR] ] 2021-09-16T12:09:55.554-04:00 [APP/PROC/WEB/0] [ERR] (node:126) UnhandledPromiseRejectionWarning: Error: Failed to launch puppeteer
For apps deployed in Cloud Foundry, its best practice to follow 12 factor app.
Shared objects libraries can not be vendored. Here are two ways you can resolve this issue:
Option 1
ssh into the app container and install the shared libraries:
$ cf ssh <app-name> $ sudo apt-get install -y libnss3-tools
Note: You may need to install the shared libraries every time you deploy the app.
Option 2
Deploy your app with two buildpacks:
Note: apt buildpack is not one of the TAS for VMs system buildpacks. You need to install apt buildpack since it does not come with the TAS for VMs installation. apt buildpack is also considered a third party buildpack which VMWare Tanzu Support does not officially support.
For more information on Multi-buildpack, refer to Cloud Foundry Multi-buildpack.