Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

345
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda