firebase / firebase-tools

The Firebase Command Line Tools
MIT License
3.97k stars 915 forks source link

Hosting deploy broken in version 13.11.4 #7387

Closed pedroleiterocha closed 3 days ago

pedroleiterocha commented 3 days ago

I have a Flutter project which I have hosted on Firebase hosting with success for some time. I've upgraded to the new version of Firebase CLI, and now my deploys have stopped working. I can see in the inspection console some error messages about a JSON failing to be parsed, and it looks like the problem is that said JSON file could not be found and JS got a "page not found" HTML instead.

I have my project configured to "rewrite all urls to /index.html", and it looks like the problem is that sub-folders are not being deployed correctly. For instance, I can open an image stored in the root folder just fine (e.g. https://fractalfa--beta-q0dy3dtr.web.app/favicon.png), but not images stored in sub-folders (e.g. https://fractalfa--beta-q0dy3dtr.web.app/icons/Icon-192.png).

I have rolled back to 13.10.2 and everything seems to work again, but I haven't tested whether they work with other versions in between them. After rolling back, the app opens correctly, as do all images cited above.

[REQUIRED] Environment info

firebase-tools: 13.11.4

Platform: Windows

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

# Build a release web version of the app
flutter build web
# Create Firebase hosting configuration
firebase init hosting
# ? Are you ready to proceed? Yes
# ? Please select an option: Use an existing project
# ? Select a default Firebase project for this directory: fractalfa (fractalfa)
# ? What do you want to use as your public directory? build/web
# ? Configure as a single-page app (rewrite all urls to /index.html)? Yes
# ? Set up automatic builds and deploys with GitHub? No
# ? File build/web/index.html already exists. Overwrite? No
firebase deploy

[REQUIRED] Expected behavior

I expected that Flutter's demo would work correctly when I opened the project's link at https://.web.app.

[REQUIRED] Actual behavior

I see nothing but a blank screen when opening the project's link. In the inspection console, I see some a null uncaught exception and some warnings about a JSON which failed to be parsed.

I have attached my web/build folder here: fractalfa.tar.gz

To get logs, I deployed to the beta channel to not break my production again. The outcome is the same though.

$ firebase hosting:channel:deploy beta --debug [2024-06-26T10:08:54.546Z] > 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-06-26T10:08:54.548Z] > authorizing via signed-in user (pedro.leite.rocha@gmail.com) [2024-06-26T10:08:54.549Z] [iam] checking project fractalfa for permissions ["firebase.projects.get","firebasehosting.sites.update"] [2024-06-26T10:08:54.552Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/fractalfa:testIamPermissions [none] [2024-06-26T10:08:54.553Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/fractalfa:testIamPermissions x-goog-quota-user=projects/fractalfa [2024-06-26T10:08:54.554Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/fractalfa:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]} [2024-06-26T10:08:55.496Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/fractalfa:testIamPermissions 200 [2024-06-26T10:08:55.496Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/fractalfa:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]} [2024-06-26T10:08:55.498Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/fractalfa [none] [2024-06-26T10:08:55.898Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/fractalfa 200 [2024-06-26T10:08:55.899Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/fractalfa {"projectId":"fractalfa","projectNumber":"415871165594","displayName":"fractalfa","name":"projects/fractalfa","resources":{"hostingSite":"fractalfa"},"state":"ACTIVE","etag":"1_037c5d01-e8e1-44f0-94bc-6ac970da896c"} [2024-06-26T10:08:55.901Z] >>> [apiv2][query] GET https://firebasehosting.googleapis.com/v1beta1/projects/fractalfa/sites/fractalfa/channels/beta [none] [2024-06-26T10:08:57.037Z] <<< [apiv2][status] GET https://firebasehosting.googleapis.com/v1beta1/projects/fractalfa/sites/fractalfa/channels/beta 200 [2024-06-26T10:08:57.037Z] <<< [apiv2][body] GET https://firebasehosting.googleapis.com/v1beta1/projects/fractalfa/sites/fractalfa/channels/beta {"name":"projects/fractalfa/sites/fractalfa/channels/beta","url":"https://fractalfa--beta-q0dy3dtr.web.app","release":{"name":"projects/fractalfa/sites/fractalfa/channels/beta/releases/1719396504057000","version":{"name":"projects/fractalfa/sites/fractalfa/versions/932a08d42e7a53e6","status":"FINALIZED","config":{"rewrites":[{"glob":"**","path":"/index.html"}]},"labels":{"deployment-tool":"cli-firebase"},"createTime":"2024-06-26T10:08:21.822556Z","createUser":{"email":"pedro.leite.rocha@gmail.com"},"finalizeTime":"2024-06-26T10:08:24.020214Z","finalizeUser":{"email":"pedro.leite.rocha@gmail.com"}},"type":"DEPLOY","releaseTime":"2024-06-26T10:08:24.057Z","releaseUser":{"email":"pedro.leite.rocha@gmail.com"}},"createTime":"2024-06-25T18:40:52.975771944Z","updateTime":"2024-06-26T10:08:24.057Z","retainedReleaseCount":10,"expireTime":"2024-07-03T10:08:21.246081962Z"} [2024-06-26T10:08:57.038Z] [hosting] found existing channel for site fractalfa {"name":"projects/fractalfa/sites/fractalfa/channels/beta","url":"https://fractalfa--beta-q0dy3dtr.web.app","release":{"name":"projects/fractalfa/sites/fractalfa/channels/beta/releases/1719396504057000","version":{"name":"projects/fractalfa/sites/fractalfa/versions/932a08d42e7a53e6","status":"FINALIZED","config":{"rewrites":[{"glob":"**","path":"/index.html"}]},"labels":{"deployment-tool":"cli-firebase"},"createTime":"2024-06-26T10:08:21.822556Z","createUser":{"email":"pedro.leite.rocha@gmail.com"},"finalizeTime":"2024-06-26T10:08:24.020214Z","finalizeUser":{"email":"pedro.leite.rocha@gmail.com"}},"type":"DEPLOY","releaseTime":"2024-06-26T10:08:24.057Z","releaseUser":{"email":"pedro.leite.rocha@gmail.com"}},"createTime":"2024-06-25T18:40:52.975771944Z","updateTime":"2024-06-26T10:08:24.057Z","retainedReleaseCount":10,"expireTime":"2024-07-03T10:08:21.246081962Z"} [2024-06-26T10:08:57.040Z] >>> [apiv2][query] PATCH https://firebasehosting.googleapis.com/v1beta1/projects/fractalfa/sites/fractalfa/channels/beta updateMask=ttl [2024-06-26T10:08:57.041Z] >>> [apiv2][body] PATCH https://firebasehosting.googleapis.com/v1beta1/projects/fractalfa/sites/fractalfa/channels/beta {"ttl":"604800s"} [2024-06-26T10:08:57.538Z] <<< [apiv2][status] PATCH https://firebasehosting.googleapis.com/v1beta1/projects/fractalfa/sites/fractalfa/channels/beta 200 [2024-06-26T10:08:57.538Z] <<< [apiv2][body] PATCH https://firebasehosting.googleapis.com/v1beta1/projects/fractalfa/sites/fractalfa/channels/beta {"name":"projects/fractalfa/sites/fractalfa/channels/beta","url":"https://fractalfa--beta-q0dy3dtr.web.app","release":{"name":"projects/fractalfa/sites/fractalfa/channels/beta/releases/1719396504057000","version":{"name":"projects/fractalfa/sites/fractalfa/versions/932a08d42e7a53e6","status":"FINALIZED","config":{"rewrites":[{"glob":"**","path":"/index.html"}]},"labels":{"deployment-tool":"cli-firebase"},"createTime":"2024-06-26T10:08:21.822556Z","createUser":{"email":"pedro.leite.rocha@gmail.com"},"finalizeTime":"2024-06-26T10:08:24.020214Z","finalizeUser":{"email":"pedro.leite.rocha@gmail.com"}},"type":"DEPLOY","releaseTime":"2024-06-26T10:08:24.057Z","releaseUser":{"email":"pedro.leite.rocha@gmail.com"}},"createTime":"2024-06-25T18:40:52.975771944Z","updateTime":"2024-06-26T10:08:58.105598404Z","retainedReleaseCount":10,"expireTime":"2024-07-03T10:08:58.105598404Z"} [2024-06-26T10:08:57.540Z] [hosting] updated TTL for existing channel for site fractalfa {"name":"projects/fractalfa/sites/fractalfa/channels/beta","url":"https://fractalfa--beta-q0dy3dtr.web.app","release":{"name":"projects/fractalfa/sites/fractalfa/channels/beta/releases/1719396504057000","version":{"name":"projects/fractalfa/sites/fractalfa/versions/932a08d42e7a53e6","status":"FINALIZED","config":{"rewrites":[{"glob":"**","path":"/index.html"}]},"labels":{"deployment-tool":"cli-firebase"},"createTime":"2024-06-26T10:08:21.822556Z","createUser":{"email":"pedro.leite.rocha@gmail.com"},"finalizeTime":"2024-06-26T10:08:24.020214Z","finalizeUser":{"email":"pedro.leite.rocha@gmail.com"}},"type":"DEPLOY","releaseTime":"2024-06-26T10:08:24.057Z","releaseUser":{"email":"pedro.leite.rocha@gmail.com"}},"createTime":"2024-06-25T18:40:52.975771944Z","updateTime":"2024-06-26T10:08:58.105598404Z","retainedReleaseCount":10,"expireTime":"2024-07-03T10:08:58.105598404Z"}

=== Deploying to 'fractalfa'...

i deploying hosting [2024-06-26T10:08:57.547Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/fractalfa/versions [none] [2024-06-26T10:08:57.548Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/fractalfa/versions {"status":"CREATED","labels":{"deployment-tool":"cli-firebase"}} [2024-06-26T10:08:58.423Z] <<< [apiv2][status] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/fractalfa/versions 200 [2024-06-26T10:08:58.424Z] <<< [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/fractalfa/versions {"name":"projects/415871165594/sites/fractalfa/versions/11b376e7fac781b5","status":"CREATED","config":{},"labels":{"deployment-tool":"cli-firebase"}} i hosting[fractalfa]: beginning deploy... i hosting[fractalfa]: found 35 files in build/web [2024-06-26T10:08:58.451Z] [hosting] uploading with 200 concurrency [2024-06-26T10:08:59.767Z] [hosting] hash cache [YnVpbGRcd2Vi] stored for 35 files [2024-06-26T10:08:59.767Z] [hosting][hash queue][FINAL] {"max":1293,"min":9,"avg":285,"active":0,"complete":35,"success":35,"errored":0,"retried":0,"total":35,"elapsed":1307} [2024-06-26T10:08:59.768Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/projects/415871165594/sites/fractalfa/versions/11b376e7fac781b5:populateFiles [none] [2024-06-26T10:08:59.768Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/415871165594/sites/fractalfa/versions/11b376e7fac781b5:populateFiles {"files":{"/version.json":"26aab1fe7a5fd060d439af49742dda476264ac9a70d6c966c4ab0c332078c736","/manifest.json":"8afc96c0631eab8cfd8cfba0fdfb28745ed9ce6a17f2dc0a52005fa36b14b0ff","/main.dart.js":"657525fa9726a7b10cc8e85c2acbdae77c31352b9fb50941c8c6cd9268fb2b72","/index.html":"364b60bf4f9748a0afa4537fa20f3dc52f69172630ee7ecf026db28c46a6b539","/flutter_service_worker.js":"3eb066f59cfe663d4b5613b0e539cdc25c0c2e1c9d3c84ae569e7c1b1de7984e","/flutter_bootstrap.js":"74c85470e5ba25bc2a4b1e1103401361e09b50313e7b693e8046d5f3eaa9ca95","/flutter.js":"07bd0b54e3d41d03ca18b5c1852570efc838b663013b014fa5d1ce5a0e623b2b","/favicon.png":"19880e004e8357a51f6a64f5d1fdc8828a6432fe9c781f8acb6b730eced2cd13","/404.html":"762bf484ba67404bd1a3b181546ea28d60dfddf18e9dd4795d8d25bcf3c1a890","/canvaskit\skwasm.worker.js":"3fd50075667dba6e3822f8300deafbd0236ef4ddaa09228f2d07fefdfc22c905","/icons\Icon-maskable-192.png":"f7ac56197638aec92f195c5344d15395c2cbf8a5ae74e846c5b4156b64f05e38","/icons\Icon-192.png":"5fd961c51d8eb53baacac01f8e53743a76f66a43390a11f5df042e8c618ad64a","/icons\Icon-512.png":"1de493563deb283e6ad70f0d5a89cfd61e37343df3b919c9862c5a41699ac5bc","/assets\FontManifest.json":"7d7d5559264043de673e1749fbaed39acfce76717625e756d4a971a9d42795e8","/assets\AssetManifest.json":"7883e6afb67586d39fa04f4e6cca465b4e34f3f29838f8d5cb1603322ec42c53","/assets\AssetManifest.bin":"3f75948f9114abf8f1d09c1e36f8d5a90d2732a58316216e7a9ebcadbe9a2a8c","/assets\shaders\ink_sparkle.frag":"591c7517d5cb43eb91ea451e0d3f9f585cbf8298cf6c46a9144b77cb0775a406","/assets\AssetManifest.bin.json":"548484e10284d484727679e1009cafc4f75aee114043def287f2d72e1314608f","/assets\packages\font_awesome_flutter\lib\fonts\fa-regular-400.ttf":"ab51d2269041647833355f2cc42723197219c4cf1a4aea1a08f2277a144caa26","/assets\packages\font_awesome_flutter\lib\fonts\fa-solid-900.ttf":"cbbd0fad443cc7c801186391e64b14c45c0013566ee643619267e490350d5d4a","/assets\fonts\MaterialIcons-Regular.otf":"6ca575614dbae38a14a39fa680a2e8c14996e3f0f51ad2c771cb93bc5170bd91","/icons\Icon-maskable-512.png":"ea58e5c49bc4dcdc5db0a9fe2f25b2a3152f85ef9094f0d020de0aa318451a1d","/assets\packages\cupertino_icons\assets\CupertinoIcons.ttf":"60833399e48367289bbe334a763bd7a99675df21053aa1480ccde5e0286b0a16","/canvaskit\skwasm.js":"2cc69cbfe8d35ea403293f3fbd429f582fa61e311eb70599f8d6665167ac01e5","/canvaskit\chromium\canvaskit.js":"60bd621b7201caee6149e7c1ea86351978ca05bd62f5bb57d1c629c5bb204784","/canvaskit\canvaskit.js":"01db01072eb5efa8a3f22e57bb44ae711f379d548d17089e788dc532d1c28978","/assets\packages\font_awesome_flutter\lib\fonts\fa-brands-400.ttf":"168847377aba5f2b834724f058848f3f9d93ca9a50ac5dde831ad3ba37157012","/assets\assets\node_tent.png":"392308bb661e08bd5d191ec9de46859dcd3305283fe61a2f9e987beca01aa922","/canvaskit\skwasm.js.symbols":"3b2a57478bff61959be3d2efbf21537651791ebee8bef8331fc76ccab20960d7","/canvaskit\chromium\canvaskit.js.symbols":"79151773a754965de2278e5e3aec9c472bd76f22733f54f19c946bb6c4209af9","/assets\NOTICES":"0564da7d4c19f9bb619b665329b85df5ecb5c774bb05dac92eae6fc061ab9181","/canvaskit\canvaskit.js.symbols":"8283e3a6b63224a5571a77ae51510ad3bd63fa64d615434372ab48ebf2bfc226","/canvaskit\skwasm.wasm":"af50878ed39aaaae896d8507d5fd925ba03d77db8e0dc304b42e9afbef924542","/canvaskit\chromium\canvaskit.wasm":"21d3a12cf4b97b3e63e062ee17667292696807a2e6cb7d10d280df10b05c4ae4","/canvaskit\canvaskit.wasm":"261e09205b1ccf31b3d6d0705d44c2b70fe519a575d9e8e89bee13368d3e7dd5"}} [2024-06-26T10:09:00.271Z] <<< [apiv2][status] POST https://firebasehosting.googleapis.com/v1beta1/projects/415871165594/sites/fractalfa/versions/11b376e7fac781b5:populateFiles 200 [2024-06-26T10:09:00.272Z] <<< [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/415871165594/sites/fractalfa/versions/11b376e7fac781b5:populateFiles {"uploadUrl":"https://upload-firebasehosting.googleapis.com/upload/sites/fractalfa/versions/11b376e7fac781b5/files"} [2024-06-26T10:09:00.273Z] [hosting][populate queue][FINAL] {"max":508,"min":508,"avg":508,"active":0,"complete":1,"success":1,"errored":0,"retried":0,"total":1,"elapsed":508} [2024-06-26T10:09:00.273Z] [hosting] uploads queued: 0 [2024-06-26T10:09:00.273Z] [hosting][upload queue][FINAL] {"max":0,"min":9999999999,"avg":0,"active":0,"complete":0,"success":0,"errored":0,"retried":0,"total":0,"elapsed":1719396540273} i hosting: upload complete

Project Console: https://console.firebase.google.com/project/fractalfa/overview Hosting URL: https://fractalfa.web.app [2024-06-26T10:09:01.720Z] >>> [apiv2][query] GET https://identitytoolkit.googleapis.com/admin/v2/projects/fractalfa/config [none] [2024-06-26T10:09:02.113Z] <<< [apiv2][status] GET https://identitytoolkit.googleapis.com/admin/v2/projects/fractalfa/config 404 [2024-06-26T10:09:02.114Z] <<< [apiv2][body] GET https://identitytoolkit.googleapis.com/admin/v2/projects/fractalfa/config {"error":{"code":404,"message":"CONFIGURATION_NOT_FOUND","status":"NOT_FOUND"}} ! hosting:channel: Unable to add channel domain to Firebase Auth. Visit the Firebase Console at https://console.firebase.google.com/project/fractalfa/authentication/providers

[2024-06-26T10:09:02.129Z] [hosting] unable to add auth domain HTTP Error: 404, CONFIGURATION_NOT_FOUND {"name":"FirebaseError","children":[],"context":{"body":{"error":{"code":404,"message":"CONFIGURATION_NOT_FOUND","status":"NOT_FOUND"}},"response":{"statusCode":404}},"exit":1,"message":"HTTP Error: 404, CONFIGURATION_NOT_FOUND","status":404} [2024-06-26T10:09:02.131Z] >>> [apiv2][query] GET https://firebasehosting.googleapis.com/v1beta1/projects/fractalfa/sites/fractalfa/channels pageToken=&pageSize=10 [2024-06-26T10:09:02.601Z] <<< [apiv2][status] GET https://firebasehosting.googleapis.com/v1beta1/projects/fractalfa/sites/fractalfa/channels 200 [2024-06-26T10:09:02.602Z] <<< [apiv2][body] GET https://firebasehosting.googleapis.com/v1beta1/projects/fractalfa/sites/fractalfa/channels {"channels":[{"name":"projects/fractalfa/sites/fractalfa/channels/beta","url":"https://fractalfa--beta-q0dy3dtr.web.app","release":{"name":"projects/fractalfa/sites/fractalfa/channels/beta/releases/1719396541644000","version":{"name":"projects/fractalfa/sites/fractalfa/versions/11b376e7fac781b5","status":"FINALIZED","config":{"rewrites":[{"glob":"**","path":"/index.html"}]},"labels":{"deployment-tool":"cli-firebase"},"createTime":"2024-06-26T10:08:58.660014Z","createUser":{"email":"pedro.leite.rocha@gmail.com"},"finalizeTime":"2024-06-26T10:09:01.596166Z","finalizeUser":{"email":"pedro.leite.rocha@gmail.com"}},"type":"DEPLOY","releaseTime":"2024-06-26T10:09:01.644Z","releaseUser":{"email":"pedro.leite.rocha@gmail.com"}},"createTime":"2024-06-25T18:40:52.975771944Z","updateTime":"2024-06-26T10:09:01.644Z","retainedReleaseCount":10,"expireTime":"2024-07-03T10:08:58.105598404Z"},{"name":"projects/fractalfa/sites/fractalfa/channels/live","url":"https://fractalfa.web.app","release":{"name":"projects/fractalfa/sites/fractalfa/channels/live/releases/1719343890947000","version":{"name":"projects/fractalfa/sites/fractalfa/versions/bb957af6f05c8152","status":"FINALIZED","config":{"rewrites":[{"glob":"**","path":"/index.html"}]},"labels":{"deployment-tool":"cli-firebase"},"createTime":"2024-06-25T19:31:28.114135Z","createUser":{"email":"pedro.leite.rocha@gmail.com"},"finalizeTime":"2024-06-25T19:31:31.152321Z","finalizeUser":{"email":"pedro.leite.rocha@gmail.com"},"fileCount":"37","versionBytes":"7841855"},"type":"DEPLOY","releaseTime":"2024-06-25T19:31:30.947Z","releaseUser":{"email":"pedro.leite.rocha@gmail.com"}},"createTime":"2024-05-10T20:39:51.193397341Z","updateTime":"2024-06-25T19:31:30.947Z","retainedReleaseCount":2147483647}]} [2024-06-26T10:09:02.604Z] >>> [apiv2][query] GET https://identitytoolkit.googleapis.com/admin/v2/projects/fractalfa/config [none] [2024-06-26T10:09:02.886Z] <<< [apiv2][status] GET https://identitytoolkit.googleapis.com/admin/v2/projects/fractalfa/config 404 [2024-06-26T10:09:02.887Z] <<< [apiv2][body] GET https://identitytoolkit.googleapis.com/admin/v2/projects/fractalfa/config {"error":{"code":404,"message":"CONFIGURATION_NOT_FOUND","status":"NOT_FOUND"}} ! hosting:channel: Unable to sync Firebase Auth state. [2024-06-26T10:09:02.888Z] [hosting] unable to sync auth domain HTTP Error: 404, CONFIGURATION_NOT_FOUND {"name":"FirebaseError","children":[],"context":{"body":{"error":{"code":404,"message":"CONFIGURATION_NOT_FOUND","status":"NOT_FOUND"}},"response":{"statusCode":404}},"exit":1,"message":"HTTP Error: 404, CONFIGURATION_NOT_FOUND","status":404}

google-oss-bot commented 3 days ago

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

aalej commented 3 days ago

Hey @pedroleiterocha, sorry that you encountered this issue. From what I can gather, the issue you’re encountering is similar to https://github.com/firebase/firebase-tools/issues/7378 and https://github.com/firebase/firebase-tools/issues/7363. In these issues, we noticed that static assets are not being uploaded.

A fix has been implemented in https://github.com/firebase/firebase-tools/pull/7382 and will be available in the next release of firebase-tools. As you mentioned, a workaround for this would be to downgrade the version of firebase-tools you’re using. Currently, using v13.11.2 should work.