firebase-tools
firebase-tools copied to clipboard
Firebase Emulator Hosting Rewrites not working until rolling back to v11.13
Firebase emulator hosting rewrites not working for v11.13 onwards, namely it is working when you've rolled back to v11.13.
firebase-tools:
Windows
[REQUIRED] Test case
firebase.json:
"rewrites": [
{
"source": "/hello{,/**}",
"function": "pdfViewer"
},
{
"source": "/**",
"function": "pdfViewer"
},
{
"source": "**",
"destination": "/index.html"
}
]
[REQUIRED] Steps to reproduce
firebase emulators:start- Open the specific rewrite target on web browser, e.g.
http://localhost:5005/ - You'll see
cannot GET /
[REQUIRED] Expected behavior
The index.html should be rendered.
[REQUIRED] Actual behavior
cannot GET / is displayed instead.
This issue does not seem to follow the issue template. Make sure you provide all the required information.
What's likely happening is that it's attempting to rewrite / (which is really /index.html to a server) to your pdfViewer function.
Is this behavior different than what happens in production? Can you provide a minimal repro of a function for pdfViewer that helps us replicate this?
Hi @bkendall , sorry for being busy with the work and the functions for pdfviewer are strictly confidential. As for the production behavior, the last deployment was on Oct 7th, 2022 without the v11.14.x -- I only updated the firebase tools after Oct 7th to v11.14.x and encountered this error. Be rest assured that I've not been changing my firebase.json hosting config for more than a year and it has been running fine until I updated my firebase tools to v11.14.*.
But what you need to know is that, it shouldn't ignore "source": "**" when there is no other parameters after http://localhost:5005 no matter what and secondly, if the pdfviewer functions were the ones that are messing up the rewrite config, even rolling back to v11.13 is useless.
Hope this helps.
One last question that'll help me narrow down what's going on. You said it works on v11.13.0 and "broken onward" but don't mention what version you are using. I suspect that v11.14.1 is where the break actually happens. Could you test your setup w/ v11.14.0 and v11.14.1 and tell me if that's the spot where it breaks? If it's in v11.14.0, that's just as useful for us too.
Yes @bkendall , I rolled back the version one step at a time based on your version history available on Github, including v11.14.0, then refresh my http://localhost:5005 for the index.html to be rendered. None of them work until v11.13.0. Now I'm using v11.13.0 for my development. Note that sometimes we skipped the version without installing when we're busy. Not all versions prompted by Firebase CLI will be installed by us. For example, when Firebase prompted us for v11.14.0 and v11.14.1, we did not install the updates until the recent one. But rolling back one step at a time may at least give us the latest that works.
One more thing @bkendall , you may need to use multi-targeting hosting config to reproduce at your end:
"hosting": [
{
"target": "store",
blah blah blah
},
{
"target": "pdf-viewer",
blah blah blah
}
]
is there a fix for this issue? +1 this issue is real for Windows Users, downgrading with does fix it - npm remove -g firebase-tools npm install -g [email protected]
it works fine deployed - this is only an issue for windows users running local - that old time relic from ms.
I have a horrible hunch that this and #5133 are related, but I discovered the other day that running the tests for superstatic (which powers the Hosting emulator) don't work on Windows, so that's a semi-serious roadblock that needs to be overcome.
I'm taking these bugs internally and putting them on our queue to address, but it may take a hot minute. We may have to roll back the superstatic library in the meantime to address this for you all.
@bkendall : Means we can upgrade to the latest Firebase Tools now?
@bkendall : Means we can upgrade to the latest Firebase Tools now?
worked for me! and it didn't work on windows before
I am having this problem, but only if I use "regex" with a regular expression instead of "source" with a glob pattern. The regular expression works in production, but when I run it on the emulator, it just gives me the 404 page. I am on windows.