Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

344
Vistas
Error while deploying firebase function which creates agora token

I have tried many things to deploy this function, installing and uninstalling node many times and many more tries but it still giving me same error. What I am trying to achieve is using agora-access-token package to generate token using firebase function the code is:

const functions = require("firebase-functions");
const {RtcTokenBuilder, RtcRole} = require("agora-access-token");

exports.agoraToken = functions.region("asia-south1").
    https.onCall((data, context)=> {
      const appID = "<myAppID>";
      const appCertificate = "myAppCertificate";
      const uid = data.uid;
      const channelId = data.channelId;
      const role = RtcRole.PUBLISHER;

      const expirationTimeInSeconds = 3600;
      const currentTimestamp = Math.floor(Date.now() / 1000);
      const privilegeExpiredTs = currentTimestamp + expirationTimeInSeconds;
      const token = RtcTokenBuilder.buildTokenWithUid(appID,
          appCertificate, channelId, uid, role, privilegeExpiredTs);
      return token;
    });

And the error is:

=== Deploying to 'xxxx'...

I deploying functions Running command: npm --prefix "$RESOURCE_DIR" run lint

lint eslint .

  • functions: Finished running predeploy script. i functions: ensuring required API cloudfunctions.googleapis.com is enabled... i functions: ensuring required API cloudbuild.googleapis.com is enabled... i functions: ensuring required API artifactregistry.googleapis.com is enabled...
  • functions: required API artifactregistry.googleapis.com is enabled
  • functions: required API cloudfunctions.googleapis.com is enabled
  • functions: required API cloudbuild.googleapis.com is enabled i functions: preparing functions directory for uploading... i functions: packaged functions (71.53 KB) for uploading
  • functions: functions folder uploaded successfully i functions: creating Node.js 14 function agoraToken(asia-south1)...

Functions deploy had errors with the following functions: agoraToken(asia-south1) i functions: cleaning up build files...

Error: There was an error deploying functions

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

The problem was that I did not added dependency in package.json file. I had to add agora-access-token dependency in package.json in function folder.

about 4 years ago · Juan Pablo Isaza Denunciar

0

What I can propose is that you use --debug because it provides information not found in the logs , and it can also fix a problematic deployment.

Try running the deployment with --debug. Example: firebase --debug deploy.

Cloud Function logs can be seen in the Firebase dashboard, the Cloud Logging UI, or the firebase command-line tool.

To view more logs, here is the link to the documentation.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda