-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
[REQUIRED] Environment info
firebase-tools: 13.8.3
Platform: Fedora 39
[REQUIRED] Test case
No tests
[REQUIRED] Steps to reproduce
Create astro project with SSR enabled
Configure firebase. In firebase init
, i select the hosting and it was recognizing the astro project, but when the setting up the github action, i prompted no. This is my .firebaserc
{
"projects": {
"default": "my-project"
},
"targets": {
"my-project": {
"hosting": {
"prd": [
"production"
],
"stg": [
"staging"
]
}
}
},
"etags": {},
}
and this is my firebase.json
{
"hosting": [
{
"target": "stg",
"source": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "asia-east1"
}
},
{
"target": "prd",
"source": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "asia-east1"
}
}
]
}
here is my ci
deploy-stg:
stage: deploy
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
changes:
- '**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'
- '.firebaserc'
- firebase.json
- .gitlab-ci.yml
script:
- touch credential.json && cp "$GCP_SERVICE_ACCOUNT" credential.json
- gcloud auth activate-service-account --key-file=./credential.json
- export GOOGLE_APPLICATION_CREDENTIALS=./credential.json
- cp "$DOT_ENV_STAGING" .env
- nvm use 20 && npm install --no-frozen-lockfile
- npx firebase experiments:enable webframeworks
- npx firebase deploy --only hosting:stg --debug
tags:
- gcp-shared
[REQUIRED] Expected behavior
The CI deployment should be working. I have tested the deployment in my local machine and it works
[REQUIRED] Actual behavior
I have the following error. I'm assuming the No OAuth tokens found
is the issue, but i don't know what is the problem. Here is the log
[2024-10-21T08:50:57.760Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2024-10-21T08:50:57.906Z] [iam] checking project my-project for permissions ["firebase.projects.get","firebasehosting.sites.update"]
[2024-10-21T08:50:57.908Z] No OAuth tokens found
[2024-10-21T08:50:57.911Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions [none]
[2024-10-21T08:50:57.911Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions x-goog-quota-user=projects/my-project
[2024-10-21T08:50:57.912Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[2024-10-21T08:50:57.978Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions 200
[2024-10-21T08:50:57.978Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[2024-10-21T08:50:57.980Z] No OAuth tokens found
[2024-10-21T08:50:57.981Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/my-project [none]
[2024-10-21T08:50:58.191Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/my-project 200
[2024-10-21T08:50:58.192Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/my-project {"my-project":"my-project","projectNumber":"885544713240","displayName":"My Project","name":"projects/my-project","resources":{"hostingSite":"my-project","storageBucket":"my-project.appspot.com","locationId":"asia-southeast1"},"state":"ACTIVE","etag":"1_9e3865a8-3d58-4604-8afd-2bef41db3846"}
[2024-10-21T08:51:51.951Z] SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at findDependency (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/.pnpm/firebase-tools@13.22.1_encoding@0.1.13/node_modules/firebase-tools/lib/frameworks/utils.js:188:23)
at getNuxtVersion (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/.pnpm/firebase-tools@13.22.1_encoding@0.1.13/node_modules/firebase-tools/lib/frameworks/nuxt/utils.js:9:45)
at discover (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/.pnpm/firebase-tools@13.22.1_encoding@0.1.13/node_modules/firebase-tools/lib/frameworks/nuxt2/index.js:25:48)
at async discover (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/.pnpm/firebase-tools@13.22.1_encoding@0.1.13/node_modules/firebase-tools/lib/frameworks/index.js:47:32)
at async prepareFrameworks (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/.pnpm/firebase-tools@13.22.1_encoding@0.1.13/node_modules/firebase-tools/lib/frameworks/index.js:192:25)
at async deploy (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/.pnpm/firebase-tools@13.22.1_encoding@0.1.13/node_modules/firebase-tools/lib/deploy/index.js:58:13)
Error: An unexpected error has occurred.
UPDATE:
i edited my firebase.json with multiple target so that i can deploy stg
to staging
and prd
to production
, and apparently using npm instead of pnpm can solve the issue, so i also update the gitlab-ci
to use npm. but i still got error. here is the log
[2024-10-21T10:44:43.028Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2024-10-21T10:44:43.151Z] [iam] checking project my-project for permissions ["firebase.projects.get","firebasehosting.sites.update"]
[2024-10-21T10:44:43.153Z] No OAuth tokens found
[2024-10-21T10:44:43.155Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions [none]
[2024-10-21T10:44:43.156Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions x-goog-quota-user=projects/my-project
[2024-10-21T10:44:43.156Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[2024-10-21T10:44:43.219Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions 200
[2024-10-21T10:44:43.220Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[2024-10-21T10:44:43.221Z] No OAuth tokens found
[2024-10-21T10:44:43.222Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/my-project [none]
[2024-10-21T10:44:43.324Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/my-project 200
[2024-10-21T10:44:43.325Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/my-project {"projectId":"my-project","projectNumber":"885544713240","displayName":"My Project","name":"projects/my-project","resources":{"hostingSite":"my-project","storageBucket":"my-project.appspot.com","locationId":"asia-southeast1"},"state":"ACTIVE","etag":"1_58efcee2-22d0-4f80-bd1c-1b0d24f0f8ec"}
Thank you for trying our experimental support for Astro on Firebase Hosting.
While this integration is maintained by Googlers it is not a supported Firebase product.
Issues filed on GitHub will be addressed on a best-effort basis by maintainers and other community members.
Documentation: https://firebase.google.com/docs/hosting/frameworks/frameworks-overview
File a bug: https://github.com/firebase/firebase-tools/issues/new?template=bug_report.md
Submit a feature request: https://github.com/firebase/firebase-tools/issues/new?template=feature_request.md
We'd love to learn from you. Express your interest in helping us shape the future of Firebase Hosting: https://goo.gle/41enW5X
WARNING: Your package.json contains a custom build that is being ignored. Only the Astro default build script (e.g, "astro build") is respected. If you have a more advanced build process you should build a custom integration https://firebase.google.com/docs/hosting/express
10:45:19 [WARN] [config] The adapter @astrojs/node provides experimental support for "astro:env getSecret". You may experience issues or breaking changes until this feature is fully supported by the adapter.
10:45:20 [types] Generated 747ms
10:45:20 [build] output: "hybrid"
10:45:20 [build] directory: /home/builds/7Wjzy3dMG/0/project-dir/dist/
10:45:20 [build] adapter: @astrojs/node
10:45:20 [build] Collecting build info...
10:45:20 [build] ✓ Completed in 1.47s.
10:45:20 [build] Building hybrid entrypoints...
Source path: /home/builds/7Wjzy3dMG/0/project-dir/node_modules/@astrojs/tailwind/base.css
Setting up new context...
Finding changed files: 200.056ms
Reading changed files: 45.935ms
Sorting candidates: 1.259ms
Generate rules: 478.608ms
Build stylesheet: 3.771ms
Potential classes: 663
Active contexts: 1
JIT TOTAL: 4.780s
Source path: /home/builds/7Wjzy3dMG/0/project-dir/node_modules/@astrojs/tailwind/base.css
JIT TOTAL: 16.984ms
Source path: /home/builds/7Wjzy3dMG/0/project-dir/public/app.css
Setting up new context...
Finding changed files: 5.177ms
Reading changed files: 38.419ms
Sorting candidates: 1.024ms
Generate rules: 458.212ms
Build stylesheet: 1.26ms
Potential classes: 663
Active contexts: 2
JIT TOTAL: 2.756s
Source path: /home/builds/7Wjzy3dMG/0/project-dir/public/app.css
JIT TOTAL: 15.109ms
10:45:46 [vite] ✓ built in 26.27s
10:45:46 [build] ✓ Completed in 26.53s.
building client (vite)
10:45:46 [vite] transforming...
10:45:58 [vite] ✓ 168 modules transformed.
10:45:59 [vite] rendering chunks...
10:46:00 [vite] computing gzip size...
10:46:00 [vite] dist/client/_astro/index.DhYZZe0J.js 6.72 kB │ gzip: 2.68 kB
10:46:00 [vite] dist/client/_astro/client.BIGLHmRd.js 135.60 kB │ gzip: 43.81 kB
10:46:00 [vite] dist/client/_astro/blog-list.C9HXIH1x.js 145.92 kB │ gzip: 51.11 kB
10:46:00 [vite] ✓ built in 13.73s
prerendering static routes
10:46:01 ▶ src/pages/blogs/index.astro
10:46:01 └─ /blogs/index.html (+224ms)
10:46:01 ▶ src/pages/index.astro
10:46:01 └─ /index.html (+15ms)
10:46:01 ✓ Completed in 1.24s.
10:46:01
finalizing server assets
10:46:01 [build] Rearranging server assets...
10:46:01 [build] Server built in 43.00s
10:46:01 [build] Complete!
[2024-10-21T10:46:12.117Z] SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at findDependency (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/firebase-tools/lib/frameworks/utils.js:188:23)
at getAstroVersion (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/firebase-tools/lib/frameworks/astro/utils.js:39:45)
at getConfig (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/firebase-tools/lib/frameworks/astro/utils.js:15:21)
at ɵcodegenPublicDirectory (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/firebase-tools/lib/frameworks/astro/index.js:43:60)
at prepareFrameworks (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/firebase-tools/lib/frameworks/index.js:241:19)
at async deploy (/home/builds/7Wjzy3dMG/0/project-dir/node_modules/firebase-tools/lib/deploy/index.js:58:
Error: An unexpected error has occurred.