'Firebase deploy - An unexpected error has occurred
I have a few firebase functions working fine locally and am able to deploy to firebase using the firebase deploy --only functions command fine. however, when I put the same in the Azure devops Pipeline, it's failing without giving me much information to debug. Please see my pipeline YAML below
trigger:
- staging
- main
pool:
vmImage: 'ubuntu-latest'
variables:
- name: buildToken
${{ if eq(variables['Build.SourceBranchName'], 'main') }}:
value: 'prod'
${{ if eq(variables['Build.SourceBranchName'], 'staging') }}:
value: 'test'
- name: envFile
${{ if eq(variables['Build.SourceBranchName'], 'main') }}:
value: '.env.prod'
${{ if eq(variables['Build.SourceBranchName'], 'staging') }}:
value: '.env.test'
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install Node.js'
- script: |
npm install -g firebase-tools
displayName: 'Install firebase tools'
- script: |
npm install env-cmd --save
displayName: 'Install env-cmd'
- task: DownloadSecureFile@1
inputs:
secureFile: '$(envFile)'
- task: CopyFiles@2
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: '$(envFile)'
TargetFolder: '$(System.DefaultWorkingDirectory)/functions'
- script: |
cd $(System.DefaultWorkingDirectory)/functions
npm install -g firebase-tools
firebase deploy --token $(FIREBASE_TOKEN) --project $(buildToken) --only functions --force
displayName: 'Deploy to firebase $(buildToken)'
And I am getting below error while running the pipeline. But the output is not enough for me to troubleshoot. Any help would be really appreciated. there should be some hint saying what's going wrong.
output in the pipeline
Starting: Deploy to firebase prod
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.201.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/e1edf3b4-c7fd-49b6-8cac-a5fa48976989.sh
/opt/hostedtoolcache/node/12.22.12/x64/bin/firebase -> /opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/firebase-tools/lib/bin/firebase.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/firebase-tools/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ [email protected]
updated 1 package in 4.728s
=== Deploying to 'geofleetprod'...
i deploying functions
✔ 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...
✔ functions: required API cloudfunctions.googleapis.com is enabled
✔ functions: required API cloudbuild.googleapis.com is enabled
i functions: preparing codebase default for deployment
i functions: Loaded environment variables from .env, .env.prod.
Error: An unexpected error has occurred.
##[error]Bash exited with code '2'.
Finishing: Deploy to firebase prod
Thanks for reading
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
