FirebaseExtended / action-hosting-deploy

Automatically deploy shareable previews for your Firebase Hosting sites
https://firebase.google.com/docs/hosting/github-integration
Apache License 2.0
705 stars 202 forks source link

[BUG] Deploys for build folder display a white screen (website with no content) #131

Closed 123MwanjeMike closed 3 years ago

123MwanjeMike commented 3 years ago

Action config

.github/workflows/firebase-hosting-pull-request.yml

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:       - uses: actions/checkout@v2       - run: rm -rf node_modules && yarn install --frozen-lockfile && yarn build       - uses: FirebaseExtended/action-hosting-deploy@v0       with:         repoToken: '${{ secrets.GITHUB_TOKEN }}'         firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PROJECT_ID }}'         projectId: PROJECT_ID         entryPoint: ./

.firebase.json

{   "hosting": {     "public": "build",     "ignore": [       "firebase.json",       "*/.",       "/node_modules/"     ],     "rewrites": [       {         "source": "**",         "destination": "/index.html"       }     ]   } }

Error message

No error message is given

Expected behavior

Website at preview URL with web content

Actual behavior

Website at preview URL is a blank white screen without any web content

Note: PROJECT_ID is not a variable, it's a place holder for my project ID

123MwanjeMike commented 3 years ago

After more analysis, I figured that this error seems not to occur if a pre built folder is pushed to remote unlike when built by the - run: rm -rf node_modules && yarn install --frozen-lockfile && yarn build step

jhuleatt commented 3 years ago

@123MwanjeMike do you see anything in the JS console when you load the preview URL in your browser? Does the HTML look like you'd expect? I ask because if Firebase Hosting is serving anything besides a 404 error page, my guess is that this is a bug in your app, and not an issue with the GitHub action.

123MwanjeMike commented 3 years ago

@jhuleatt the HTML I see is the default content of the build/index.html file only. This I think is because it does not "rewrite all urls to /index.html" as should be the case for Single Page Applications. I however doubt it's a bug with with my app because its hosted and working fine on firebase hosting(using cloud build), but let me continue to investigate it.

123MwanjeMike commented 3 years ago

I figured it was a problem with my firebase configurations as I had not added the environment variables to the build step