Repository navigation
Conversation
Summary of ChangesHello @fwal, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical race condition that occurred during the parallel deployment of multiple Firebase Hosting projects, particularly those utilizing rewrite rules with Cloud Functions. By transitioning the deployment mechanism from parallel to sequential execution, the system now reliably identifies and links all functions, preventing previous issues where endpoints would fail to function correctly. This change ensures deployment stability without a significant performance overhead. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively resolves a race condition during the deployment of multiple hosting sites by switching from parallel to sequential execution. The change from Promise.all to a for...of loop is a direct and appropriate fix for the issue. The code is clear and the PR is well-documented. I've added one suggestion to improve code maintainability by documenting the reason for the sequential execution.
|
Thanks. Your catch that it works fine in series meant that there was a race condition elsewhere and I think I've fixed it in #9240. It should be released soon, and you can check it out then! Thanks for this effort, but I think we've fixed the root cause now :) |
|
Hi @bkendall, that's great! Had a feeling someone with better knowledge about the codebase could pinpoint the cause 😄 |
Description
Fixes an issue (#9235) that occurs when deploying multiple hosting projects that uses rewrite rules with functions.
When deploying each project individually, everything works, but when deploying them all at once results in the follow warning being displayed in the console:
As a result the endpoint doesn't work. (the above warning should probably be a fatal error?)
This seems to stem somewhere from the
convertConfigfunction somewhere around backend- or findEndpointForRewrite-lookup but haven't located the exact source.Due to the fact that deploying each hosting individually works, I changed the execution of deploying multiple hosts to be sequential instead of parallel and that solved the issue. As deploying hosts is pretty quick, the performance hit is negligible in my opinion.
Example
{ "functions": [ { "codebase": "exampleCodebase", "source": "example-codebase" } ], "hosting": [ { "target": "example-api", "public": "site/example-api", "rewrites": [ { "source": "/v1/**", "function": { "functionId": "runApiV1" } }, { "source": "**", "destination": "/index.html" } ] }, { "target": "example-dynamic", "public": "site/example-dynamic", "rewrites": [ { "source": "**", "function": { "functionId": "hostExampleDynamicSite" } } ] }, { "target": "example-static", "public": "site/example-static", "rewrites": [ { "source": "**", "destination": "/index.html" } ] } ] }Output before the fix
Output after the fix
Scenarios Tested
firebase deploy --only hostingfirebase deploy --only hosting:{name}Sample Commands
No changes in commands