Puppeteer not working in Google App Engine? - node.js

error while loading shared libraries: libnss3.so cannot open shared object file
I want to deploy my puppeteer app on google app engine since it says their node.js environment supports the puppeteer however
I get still get this error.
What do I need to do?

Puppeteer requires custom libraries, so you need to make sure you are using the custom environment in your app.yaml:
runtime: custom env: flex
You can find a similar issue in this Github thread.
You also need to check the App Engine documentation for your language that describes dependencies specification to make sure your steps are aligned with the guidelines.
If you are using the App Engine Standard environment, the Node.js runtime of the App Engine standard environment comes with all system packages needed to run Headless Chrome.
To use puppeteer, simply list the module as a dependency in your package.json and deploy to Google App Engine. Read more about using puppeteer on App Engine by following the official tutorial.

Related

Puppeteer not working in the google app engine

I have built one project in node js. that create a pdf using puppeteer after submitting some from the HTML form. Everything is working fine in localhost. But, pdf in generating in google app engine environment after deploy. This project is on my github profile. Project on Github
Running Puppeteer on GCP is supported now with App engine and Cloud Functions.
Running Puppeteer on Google App Engine
The Node.js runtime of the App Engine standard environment comes with all system packages needed to run Headless Chrome.
To use puppeteer, simply list the module as a dependency in your package.json and deploy to Google App Engine. Read more about using puppeteer on App Engine by following the official tutorial.
Running Puppeteer on Google Cloud Functions
The Node.js 10 runtime of Google Cloud Functions comes with all system packages needed to run Headless Chrome.
To use puppeteer, simply list the module as a dependency in your package.json and deploy your function to Google Cloud Functions using the nodejs10 runtime.
https://developers.google.com/web/tools/puppeteer/troubleshooting#running_puppeteer_in_the_cloud
puppeteer will not work same as expected with google app engine standard environment. You can use a flexible environment with Docker to work as expected. Or you can also use a compute engine with your own configurations.

How do I setup and deploy a local execution app for Google smart home action?

I am implementing the local execution functionality for my google smart home action. I am following the steps in this link:
https://developers.google.com/actions/smarthome/develop/local
I have already configured the scanning data in the console, and now I am trying to deploy my local execution app. I know how to program in javascript, I have created a couple of firebase functions, but I am not an expert in node.js. I don't understand how to setup and run this javascript app.
I tried to run it on the browser, but it says it cannot find "require", and I read that node.js is not supposed to run on client side. In the link above, it says to create an index.html, that declares the "local_execution.js". Is this javascript module going to run on client side? Can someone point me in the right direction? Maybe explain how to setup the app directory.
Thank you in advance,
Henrique
The best place to get started would be with the local home sample app on GitHub. This sample includes both a local execution app and a compatible virtual device, with instructions to get it compiled and deployed.
For testing, you need to host the web app (HTML/JavaScript) in a location that's accessible to your Home device. This could be a local dev server or something like Firebase Hosting (the sample has instructions for both). The hosted URL goes in the console under Test > On device testing.
I tried to run it on the browser, but it says it cannot find "require", and I read that node.js is not supposed to run on client side.
The Home devices run a browser-based (Chrome) environment, so your JavaScript must be compatible with the browser. If you use Node programming paradigms (e.g. importing modules using require) in your code, you need to use a bundler tool such as Webpack or Parcel to package the code for the browser. The sample uses Webpack to accomplish this.
Side Note: You can't run even a properly packaged local home app in the browser on your development machine because the local home SDK only exists on Home devices.

Deploy Python app with textract module to Google Cloud Platform

I want to create a Python script that will parse 40.000 PDF files(text and images). Since I saw that there is no easy method to check if a page contains images I think I should use textract module.
Ideally I would deploy to Google App Engine.
My question is, for textract I've also installed other packages beside Python to my system. Can I deploy the script(with proper requirements.txt file) on Google Cloud App Engine without problem? or I will to use something else?
It is possible to use App Engine, but only with the Flexible environment and using a custom runtime, which allows you to add non-python dependencies (and also python dependencies not installable via pip):
Custom runtimes allow you to define new runtime environments, which
might include additional components like language interpreters or
application servers.
See also Building Custom Runtimes.

Deploy node application to Google App Engine standard environment

Until december 2016, I was able to deploy node applications to Google App Engine standard environment with an app.yaml looking like this:
runtime: nodejs
vm: true
api_version: 1
manual_scaling:
instances: 1
Now, when I do this to deploy to a new project, I get this error message:
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: Deployments to App Engine
Flexible require 'env: flex' in app.yaml. The 'vm:true' setting has
been deprecated.
But I'm still able to deploy with this configuration for existing projects.
Has something changed recently in Google App Engine for Node.js ? (I don't know when reading the error message if standard environment is deprecated, or if for some reason it considers I chose to deploy to a flexible environment, and so I can't use vm:true because this option is deprecated for flexible environments).
The vm: true indicates you were actually deploying to the flexible environment (an earlier version). The standard environment never supported node.js apps, see https://cloud.google.com/appengine/docs.
Yes, there was a change in the flexible environment (all languages, not only node.js). See Upgrading to the Latest App Engine Flexible Environment Beta Release. From there, explaining why your existing apps still work:
Applications created with vm:true
All applications created in the vm:true environment will continue to
work for at least 6 months after the App Engine flexible environment
becomes generally available. At that point, all customers need to
switch to the env:flex environment.
UPDATE:
Node.JS is currently available in the standard environment as well, see:
Now, you can deploy your Node.js app to App Engine standard environment
Google App Engine Node.js Standard Environment Documentation

Node-Webkit and AngularJS package apps: require not defined

I am using https://github.com/mllrsohn/grunt-node-webkit-builder to package my node-webkit app which is built using AngularJS.
The app works fine on MAC when I build from Sublime Text. But when I package the app using any packaging tool, I get the error saying "require is not defined". What am I missing?
For more context, I have a services layer which is written in Node.js using express. The Angular project calls Node.js APIs and renders the content. I am using a SQLite3 DB. Which is the best way to package such apps? I am alright with writing an installer starts Node.js server separately.
You'll always get a "require is not defined" error if you don't use a node-webkit environement for developpement in Windows. You can use nodebob for developpement environement :
You have to put your html files into nodebob\buildTools\nw and then run nw.exe
Just reload it after your changes

Resources