【问题标题】:Firebase emulator: see outgoing HTTP trafficFirebase 模拟器:查看传出的 HTTP 流量
【发布时间】:2022-10-07 00:17:27
【问题描述】:

我有一个调用 Chargebee 的云函数。在index.ts:

const chargeBee = new ChargeBee();
...
chargeBee.configure({
    site,
    api_key: apiKey
});
...
export const finalizeSignup = https.onCall(
    async (info: SignupInfo, ctx: CallableContext) => {
        const cbCmd = chargeBee.hosted_page.retrieve(info.cbHostedPage);
        const callbackResolver = new Promise<any>((resolve, reject) => {
            // cbCmd.request returns a Promise that seems to do nothing.
            // The callback works, however.
            // Resolve/reject the Promise with the callback.
            void cbCmd.request((err: any, res: any) => {
                if (err) {
                    reject(err);
                }
                resolve(res);
            });
        });
        // Calling Promise.resolve subscribes to the Promise.
        return Promise.resolve(callbackResolver);
    }
);

我正在使用通过 firebase emulators:start --only functions 启动的 Firebase 模拟器测试此功能。 Chargebee 的反应很奇怪。他们要求将传入请求的域列入白名单:我的第一个猜测是我的本地模拟云函数使用的域在 Chargebee 端没有列入白名单。

如何查看本地模拟 Cloud Function 发送的传出 HTTP 信息?

    标签: firebase firebase-tools chargebee


    【解决方案1】:

    非权威的答案:模拟器不提供这样的功能。您必须应用自己的工具来监控 HTTP 流量(即 Wireshark)。

    假设它是HTTP!上面的示例使用的是 HTTPS,如果不知道 SSL 密钥就无法监控。在上面的设置中,第三方库正在处理请求,我知道无法获取 SSL 密钥。我向 Firebase 输入了一个功能请求,以评估在启动 Functions 模拟器时开发一种定义 SSL 密钥日志的方法的兴趣,类似于 Chrome

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-07
      • 1970-01-01
      • 1970-01-01
      • 2016-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-06
      相关资源
      最近更新 更多