在尝试使用格子创建资产报告时,如何解决未经身心的错误?使用云功能的格子createAssetReport

发布于 2025-02-12 07:02:10 字数 2113 浏览 1 评论 0原文

我正在尝试从格子创建 Asset Report ,我正在为这些调用使用云功能,所有其他云功能都起作用(链接,交易,平衡),但是AssetReportCreate失败并返回未经身份验证

“在此处输入图像说明”

格子日志不显示呼叫...所以我猜某物我的云功能是错误的,但是Google控制台日志显示状态200。

是否有人遇到过同样的问题并知道如何修复它?

PS:立即进行双检查以确保我经过身份验证,并且我是...

//create ASSET report
exports.createAssetReport = functions.https.onCall(async (data, context) => {
  const accessToken = data.accessToken;
  const daysRequested = data.daysRequested;
  // const options = {
  //   client_report_id: '123',
  //   webhook: "https://www.example.com", //to let you know when report is ready, get link from cloud console
  // };

  const configuration = new Configuration({
    basePath: PlaidEnvironments[functions.config().app.env],
    baseOptions: {
      headers: {
        "PLAID-CLIENT-ID": functions.config().plaid.client_id,
        "PLAID-SECRET": functions.config().plaid.secret,
      },
    },
  });

  const plaidClient = new PlaidApi(configuration);

  //call the createLinkToken  METHOD of the plaidClient instance!
  return plaidClient
    .assetReportCreate({
      access_tokens: [accessToken],
      days_requested: daysRequested,
      //options,
    })
    .then((response) => {
      const assetReportId = response.data.asset_report_id;
      const assetReportToken = response.data.asset_report_token;
      return assetReportToken; //token is needed to retrieve the report via //pdf/get
    }) 
    .catch((err) => {
      console.log(err);
      throw new functions.https.HttpsError(
        "internal",
        " Unable to create asset report: " + err
      );
    });
});

I'm trying to create an asset report from Plaid, I'm using Cloud Functions for these calls, all the other cloud functions work (link, transactions, balance) but assetReportCreate fails and return UNAUTHENTICATED

enter image description here

The Plaid logs do not show the call...so I guess something is wrong in my Cloud Function, but the Google Console Logs show status 200.
enter image description here

has anybody experienced the same issue and know how to fix it?

PS: just double checked today to make sure I'm authenticated and I am...
enter image description here

//create ASSET report
exports.createAssetReport = functions.https.onCall(async (data, context) => {
  const accessToken = data.accessToken;
  const daysRequested = data.daysRequested;
  // const options = {
  //   client_report_id: '123',
  //   webhook: "https://www.example.com", //to let you know when report is ready, get link from cloud console
  // };

  const configuration = new Configuration({
    basePath: PlaidEnvironments[functions.config().app.env],
    baseOptions: {
      headers: {
        "PLAID-CLIENT-ID": functions.config().plaid.client_id,
        "PLAID-SECRET": functions.config().plaid.secret,
      },
    },
  });

  const plaidClient = new PlaidApi(configuration);

  //call the createLinkToken  METHOD of the plaidClient instance!
  return plaidClient
    .assetReportCreate({
      access_tokens: [accessToken],
      days_requested: daysRequested,
      //options,
    })
    .then((response) => {
      const assetReportId = response.data.asset_report_id;
      const assetReportToken = response.data.asset_report_token;
      return assetReportToken; //token is needed to retrieve the report via //pdf/get
    }) 
    .catch((err) => {
      console.log(err);
      throw new functions.https.HttpsError(
        "internal",
        " Unable to create asset report: " + err
      );
    });
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

木緿 2025-02-19 07:02:11

我发现,无论出于何种原因,所有用户都没有打开函数,添加了一个校长,扮演着角色:“云功能调用”解决了问题,对您感到羞耻,我花了两个完整的这几天! JK,感谢您的服务,但请修复这些小细节,您可以成为#1云提供商

“ https://i.sstatic.net/efleh.png” alt =“在此处输入图像说明”>

I found that for whatever reason the function wasn't open for all users to invoke, adding a principal with role: "cloud functions invoker" fixed the issue, shame on you google cloud, I spent two full days on this!! jk, thanks for your services but fix these small details and you could become the #1 cloud provider

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文