Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Callable functions with custom region not working, Unauthenticated error

Aperta
#3,409 2 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
angular, firebase, typescript
Ambito
api, backend

Direzione di ricerca

Esamina la definizione della funzione callable, app.module.ts, firebase.json e il componente Angular che usa httpsCallableData, confrontando la regione configurata europe-west1 con la configurazione di produzione distribuita. Riproduci la chiamata di produzione e traccia il motivo per cui restituisce Unauthenticated; il lavoro è completato quando la funzione callable V1 distribuita funziona dall’applicazione Angular senza questo errore.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
7.8k
Fork
2.2k
Merge medio
3g 6h
PR unite (30g)
5

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di angular/angularfire

Tutte le issue di angular/angularfire

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.