Firebase-admin-node: FR:Support proxy for local testing

Created on 8 Apr 2018  路  3Comments  路  Source: firebase/firebase-admin-node

[REQUIRED] Step 2: Describe your environment

  • Operating System version: Linux archlinux 4.15.15-1-ARCH #1 SMP PREEMPT Sat Mar 31 23:59:25 UTC 2018 x86_64 GNU/Linux
  • Library version: 5.12.0
  • Firebase Product: Cloud Messaging

[REQUIRED] Step 3: Describe the problem

My local computer is behind proxy so the Node.js Admin SDK can't send the request to FCM server. It will be great if it supports HTTP proxy or proxy agent.

feature request

Most helpful comment

We can probably support specifying an HTTP/S agent as an AppOption.

const tunnel = require('tunnel');

admin.initializeApp({
  httpsAgent: tunnel.httpsOverHttps({
    proxy: {
      host: 'my.proxy.host',
      port: 3128,
    },
  }),
});

Users will have to install tunnel (or an equivalent library) and initialize the Admin SDK as shown above. Does that sound like a reasonable solution?

All 3 comments

You can try this package as a workaround until it is supported officially:
https://github.com/np-maintain/global-tunnel

We can probably support specifying an HTTP/S agent as an AppOption.

const tunnel = require('tunnel');

admin.initializeApp({
  httpsAgent: tunnel.httpsOverHttps({
    proxy: {
      host: 'my.proxy.host',
      port: 3128,
    },
  }),
});

Users will have to install tunnel (or an equivalent library) and initialize the Admin SDK as shown above. Does that sound like a reasonable solution?

402 implements the support for specifying an http.Agent for the SDK. This use case should be supported now.

Was this page helpful?
0 / 5 - 0 ratings