CORS error for a Firebase Extension "Authenticate with Stream Chat" Function on localhost (Angular)

オープン
#539 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
angular, typescript
領域
api, backend

調査の方向性

Firebase 関数 getStreamUserToken の Angular httpsCallable 呼び出しから始め、拡張機能の callable エンドポイントが http://localhost:4200 からのリクエストをどのように処理するかを調査します。ブラウザの preflight の失敗と関数の設定を比較します。localhost から報告された CORS エラーなしで関数を呼び出せれば完了です。

索引モデルが issue の本文から書いたものです。

説明

In summary, I'm trying to use an extension called "Authenticate with Stream Chat." Inside the extension, there are several functions. One of them is an onCall function called "getStreamUserToken" which returns the user token. Here's how I'm calling it from the client side:

getStreamToken() { const result = httpsCallable( this.functions, 'getStreamUserToken' ); result({}).then((response) => { console.log(response.data); }); }
However, I'm encountering the following error:

Access to fetch at 'https://us-central1-project.cloudfunctions.net/getStreamUserToken' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I understand that this is a CORS error, and I'd like to resolve it.

Please, I've been stuck here for weeks. Thanks in advance!

主要言語
TypeScript
スター
18
フォーク
4
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

GetStream/stream-firebase-extensions のほかの issue

GetStream/stream-firebase-extensions の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。