googlearchive / cloud-functions-emulator

A local emulator for deploying, running, and debugging Google Cloud Functions.
https://github.com/GoogleCloudPlatform/cloud-functions-emulator/wiki
Apache License 2.0
827 stars 115 forks source link

Add Proxy Support #201

Open gutenye opened 6 years ago

gutenye commented 6 years ago

Thanks for stopping by to let us know something could be better!

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

Steps to reproduce

  1. $ functions start
  2. $ functions deploy hello --trigger-http

Got

functions deploy hello --trigger-http
ERROR: Error: read ECONNRESET
    at RequestError.Error (native)
    at new RequestError (/usr/local/lib/node_modules/@google-cloud/functions-emulator/node_modules/googleapis/node_modules/google-auth-library/lib/transporters.js:34:42)
    at Request._callback (/usr/local/lib/node_modules/@google-cloud/functions-emulator/node_modules/googleapis/node_modules/google-auth-library/lib/transporters.js:108:23)
    at Request.self.callback (/usr/local/lib/node_modules/@google-cloud/functions-emulator/node_modules/request/request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/@google-cloud/functions-emulator/node_modules/request/request.js:1163:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/@google-cloud/functions-emulator/node_modules/request/request.js:1085:12)

The local emulator needs to access Google auth service, but all Google services are blocked in China. So I need to use a proxy for it.

I tried

No luck, it seems local emulator does not support proxy yet. And I haven't find any documentation related to proxy on the Wiki.

planetjones commented 6 years ago

Why does the emulator need to phone home (Google, Mountain View ) ? I am facing a similar issue and would like to be able to use the emulator while travelling without an Internet connection. I get a timeout when issuing "functions start":

at new RequestError (C:\Users\s3cnpj\Downloads\node-v8.4.0-win-x64\node_modules\@google-cloud\functions-emulator\node_modules\googleapis\node_modules\google-auth-library\lib\transporters.js:34:42)

yatszhash commented 6 years ago

I met same problems too under proxy on windows. On windows, I got

''' ERROR: Error: getaddrinfo EAI_AGAIN cloudfunctions.googleapis.com:443 at new RequestError (C:\Users\USER_NAME\AppData\Roaming\npm\node_modules\@google-cloud\functions-emulator\node_modules\googleapis\node_modules\google-auth-lib rary\lib\transporters.js:34:42) at Request._callback (C:\Users\USER_NAME\AppData\Roaming\npm\node_modules\@google-cloud\functions-emulator\node_modules\googleapis\node_modules\google-auth-li brary\lib\transporters.js:108:23) '''

lfsanchezg commented 5 years ago

as of this date... this is still not fixed... Tried the same options, setting the proxy on node, and as environment variable.