Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Callable functions with custom region not working, Unauthenticated error

Đang mở
#3,409 2 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
angular, firebase, typescript
Lĩnh vực
api, backend

Hướng nghiên cứu

Xem lại định nghĩa của callable function, app.module.ts, firebase.json và Angular component sử dụng httpsCallableData, đồng thời so sánh region europe-west1 đã cấu hình với production setup đã triển khai. Tái hiện lời gọi production và truy tìm lý do nó trả về Unauthenticated; công việc được xem là hoàn tất khi callable V1 đã triển khai hoạt động từ Angular application mà không có lỗi đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Version info

Angular:
15.2.2

Firebase:
9.23.0

AngularFire:
7.6.1

How to reproduce these conditions

Steps to set up and reproduce

  1. Create angular 15 project
  2. Add angularfire
  3. Create callable functions with custom region
Debug output

** Errors in the JavaScript console **

main.fc6d01fc3332ae31.js:1 ERROR Error: Uncaught (in promise): Error: FirebaseError: Unauthenticated
Error: FirebaseError: Unauthenticated

** Output from firebase.database().enableLogging(true); **

How/where do I enable this?

Callable function:

import { region } from 'firebase-functions';

export const getInvoicesPerQuarter= region('europe-west1')
  .https.onCall(async (data: { id: string; invoiceNumber: string }, context) => {
...
})

app.module.ts:

   provideFunctions(() => {
      const functions = getFunctions(getApp(), 'europe-west1');
      // const functions = getFunctions();
      if (environment.useEmulators) {
        connectFunctionsEmulator(functions, 'localhost', 5001);
      }
      return functions;
    }),

firebase.json:

{
  "hosting": [
    {
      "rewrites": [
        {
          "source": "/getInvoicesPerQuarter",
          "function": "getInvoicesPerQuarter"
        }
      ]
    },

angular component:

import { Functions, httpsCallableData } from '@angular/fire/functions';

 const getInvoicesPerQuarterCallable: (data: {
          year: number;
          quarter: number;
        }) => Observable<string> = httpsCallableData<
          { year: number; quarter: number },
          string
        >(this.functions, 'getInvoicesPerQuarter');

        const result = await firstValueFrom(
          getInvoicesPerQuarterCallable({ year, quarter }),
        );

Calling this callable function works in the emulator.
I deploy this to firebase.
I doesn't work on production and I get the Unauthenticated error.
I already contacted firebase support but everything looks fine and they say it's an AngularFire issue and can't help me.
Functions are V1.

Ngôn ngữ chính
TypeScript
Star
7.8k
Fork
2.2k
Merge trung bình
3 ngày 6 giờ
Pull request đã merge (30 ngày)
5

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của angular/angularfire

Tất cả issue của angular/angularfire

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.