GoogleCloudPlatform / cloud-builders-community

Community-contributed images for Google Cloud Build
https://cloud.google.com/cloud-build/
Apache License 2.0
1.25k stars 851 forks source link

Cloud Build: Firebase application deployment failed due to the experimental web framework not being enabled. #635

Open sebastianrychlik opened 11 months ago

sebastianrychlik commented 11 months ago

I get an error in Cloud Build for last "Deploy" step:

Deploy

The error is:

"Step 2: Error: Cannot deploy a web framework from source because the experiment webframeworks is not enabled. To enable webframeworks run firebase experiments:enable webframeworks"

haroonc commented 11 months ago

@sebastianrychlik Can you provide more details on the image you are using gcr.io/cloudfirebaseauthmydemo/firebase? From the error message, it seems your image is running firebase command, but I am not sure. Further, from error message it seems you need to enable a config. Perhaps below project setup will help

run firebase experiments:enable webframeworks

sebastianrychlik commented 11 months ago

@haroonc Hi Harron,

Thanks for the answer. Regarding gcr.io/cloudfirebaseauthmydemo/firebase, I did the following: 1.

git clone https://github.com/GoogleCloudPlatform/cloud-builders-community cd cloud-builders-community/firebase file firebase.bash dos2unix firebase.bash file firebase.bash gcloud builds submit --config cloudbuild.yaml --project cloudfirebaseauthmydemo gcloud container images list --filter firebase --project cloudfirebaseauthmydemo

2. Regarding my Angular project:

I prepared simple cloudbuild.yaml:

steps:

'# Install'

'# Build'

options: logging: CLOUD_LOGGING_ONLY

3. firebase experiments:enable webframeworks 4. firebase init hosting

I noticed that two yaml files in .github\workflows were been generated:

This file was auto-generated by the Firebase CLI

https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge 'on': push: branches:

and second yaml file:

This file was auto-generated by the Firebase CLI

https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR 'on': pull_request jobs: build_and_preview: if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}' runs-on: ubuntu-latest steps:

Important is that there was no question given: Answer yes to "Do you want to use a web framework? (experimental)" Full interaction after 'firebase init hosting' is below:

$ firebase init hosting

 ######## #### ########  ######## ########     ###     ######  ########
 ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
 ######    ##  ########  ######   ########  #########  ######  ######
 ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
 ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

C:\Users\HP_OMEN\Projects\CloudFirebaseAuthMyDemo\Angular-v15\CloudFirebaseAuthMyDemo

Before we get started, keep in mind:

? Are you ready to proceed? Yes

=== Project Setup

First, let's associate this project directory with a Firebase project. You can create multiple project aliases by running firebase use --add, but for now we'll just set up a default project.

i Using project cloudfirebaseauthmydemo (CloudFirebaseAuthMyDemo)

=== Hosting Setup ? Detected an existing Angular codebase in the current directory, should we use this? Yes ? In which region would you like to host server-side content, if applicable? us-central1 (Iowa) ? Set up automatic builds and deploys with GitHub? Yes

i Detected a .git folder at C:\Users\HP_OMEN\Projects\CloudFirebaseAuthMyDemo\Angular-v15\CloudFirebaseAuthMyDemo i Authorizing with GitHub to upload your service account to a GitHub repository's secrets store.

Visit this URL on this device to log in: https://github.com/login/oauth/authorize?client_id=89cf50f02ac6aaed3484&state=773283530&redirect_uri=http%3A%2F%2Flocalhost%3A9005&scope=read%3Auser%20repo%20public_repo

Waiting for authentication...

? For which GitHub repository would you like to set up a GitHub workflow? (format: user/repository) sebastianrychlik/CloudFirebaseAuthMyDemoV15

? Set up the workflow to run a build script before every deploy? Yes ? What script should be run before every deploy? (npm ci && npm run build) npm ci && npm run build ? What script should be run before every deploy? npm ci && npm run build ? GitHub workflow file for PR previews exists. Overwrite? firebase-hosting-pull-request.yml Yes

i Action required: Visit this URL to revoke authorization for the Firebase CLI GitHub OAuth App: https://github.com/settings/connections/applications/89cf50f02ac6aaed3484 i Action required: Push any new workflow file(s) to your repo

i Writing configuration info to firebase.json... i Writing project information to .firebaserc...

5. After pushing to Github release branch, cloudbuild.yaml is executed. For last step 'Deploy', I get:

2023-09-28 16:33:02.411 CEST Step #2: Status: Downloaded newer image for gcr.io/cloudfirebaseauthmydemo/firebase:latest 2023-09-28 16:33:02.418 CEST Step #2: gcr.io/cloudfirebaseauthmydemo/firebase:latest 2023-09-28 16:33:07.993 CEST Step #2: 2023-09-28 16:33:07.993 CEST Step #2: Error: Cannot deploy a web framework from source because the experiment webframeworks is not enabled. To enable webframeworks run firebase experiments:enable webframeworks