gcloud-node

Uploading a buffer to google cloud storage

懵懂的女人 提交于 2019-12-03 05:48:57
I'm trying to save a Buffer (of a file uploaded from a form) to Google Cloud storage, but it seems like the Google Node SDK only allows files with a given path to be uploaded (Read / Write streams). This is what I have used for AWS (S3) - is the anything else similar in the Google node SDK?: var fileContents = new Buffer('buffer'); var params = { Bucket: //bucket name Key: //file name ContentType: // Set mimetype Body: fileContents }; s3.putObject(params, function(err, data) { // Do something }); The only way that I have found to do it so far is write the buffer to disk, upload the file using

How to get remote client's IP address in an express based Node JS app running on App-Engine

微笑、不失礼 提交于 2019-12-01 08:18:51
问题 While trying to get IP, all standard headers values contain incorrect value. req.ip: ::ffff:172.17.0.5 req.headers['x-forwarded-for']: 169.254.160.2 req.socket.remoteAddress: ::ffff:172.17.0.5 All of these result in wrong ip. 回答1: Solutions: Either use let ip = req.headers['x-appengine-user-ip'] or Use Express's trust proxy settings by using app.set('trust proxy', true); Explanation: https://cloud.google.com/appengine/docs/flexible/nodejs/runtime#https_and_forwarding_proxies App Engine

How to fix “`The --custom_entrypoint flag must be set for custom runtimes`”?

坚强是说给别人听的谎言 提交于 2019-11-30 20:18:22
I get this error on appengine when I run gcloud preview app run app.yaml : The --custom_entrypoint flag must be set for custom runtimes My app.yaml looks like: version: 0-1-1 runtime: custom vm: true api_version: 1 manual_scaling: instances: 1 handlers: - url: .* script: dynamic My dockerfile is just: FROM google/nodejs-runtime I reinstalled gcloud to get the latest version, did something change in the yaml config for managed VMs? This makes it impossible for me to test my app. Jeff Deskins There appears to be a bug or setup issue with Google Cloud SDK version 0.9.67 causing this error. As a

How to fix “`The --custom_entrypoint flag must be set for custom runtimes`”?

核能气质少年 提交于 2019-11-30 03:47:38
问题 I get this error on appengine when I run gcloud preview app run app.yaml : The --custom_entrypoint flag must be set for custom runtimes My app.yaml looks like: version: 0-1-1 runtime: custom vm: true api_version: 1 manual_scaling: instances: 1 handlers: - url: .* script: dynamic My dockerfile is just: FROM google/nodejs-runtime I reinstalled gcloud to get the latest version, did something change in the yaml config for managed VMs? This makes it impossible for me to test my app. 回答1: There