-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 BUG: Received a malformed response from the API #1222
Comments
I am encountering this issue as well. All was fine yesterday, attempting to republish (the same code that worked yesterday) yields a malformed response error. It does appear the publication is successful even with the error. |
Is the size of the Worker script particularly large? Can you try running Wrangler in a debugger, pausing at the point this error is thrown and checking what the The relevant code is: |
The API is returning the entire script content, it is a parse error within the Error:
When saving the output to a JSON file, the script contents arent properly escaped. The rest of the payload is fine. Below is some questionable regex I wrote for removing the script before parsing. It is working for me locally, however, it is not a solution to this issue. let jsonText = await response.text();
jsonText = jsonText.replace(/"script":[\s\S]*",\n/igm, ''); |
I wonder if this is related to #1219? |
I do have an orange cloud, this is a worker-only domain, not a worker proxy. |
@0x15f - when you say worker-only domains are you talking abut the new custom domain setup? I.e. routes = [ { pattern: "abc.com", custom_domain: true } ] |
Yes, custom domains, my apologies for the miswording. |
When you say:
can you describe what exactly is not being escaped correctly? For example is it the quotation marks or something? |
I cannot precisely tell what is not being escaped, the payload is too large for VSCode to syntax highlight it all. Below is the link to a gist with the response. When copying it into jsonformatter.org it yields
I think it may be in code comments causing the JSON to break. I am going to do more testing with our build to figure out exactly what.
https://gist.github.com/0x15f/48014b9c09416ca2940d8275bfeb39ee |
Thanks for providing that. It turns out that the problem is that there are three instances of |
When we upload a script bundle, we get the actual content of the script back in the response. Sometimes that script can be large (depending on whether the upload was large), and currently it may even be a badly escaped string. We can pass a queryparam `excludeScript` that, as it implies, exclude the script content in the response. This fix does that. Fixes #1222
When we upload a script bundle, we get the actual content of the script back in the response. Sometimes that script can be large (depending on whether the upload was large), and currently it may even be a badly escaped string. We can pass a queryparam `excludeScript` that, as it implies, exclude the script content in the response. This fix does that. Fixes #1222
We have a fix rolling out on the api side (hopefully this week?), and a wrangler pr that leverages that fix (#1248) which we'll land soon after |
When we upload a script bundle, we get the actual content of the script back in the response. Sometimes that script can be large (depending on whether the upload was large), and currently it may even be a badly escaped string. We can pass a queryparam `excludeScript` that, as it implies, exclude the script content in the response. This fix does that. Fixes #1222
When we upload a script bundle, we get the actual content of the script back in the response. Sometimes that script can be large (depending on whether the upload was large), and currently it may even be a badly escaped string. We can pass a queryparam `excludeScript` that, as it implies, exclude the script content in the response. This fix does that. Fixes #1222
I'll keep this issue open until the api fix rolls out |
I believe the escaping bug has been fixed on the api end, and the additional fix to not include it given the excludeScript query params will be rolled out soon. So I'm going to close this. Thanks everyone for reporting! |
What version of
Wrangler
are you using?2.0.8
What operating system are you using?
Mac
Describe the Bug
I can't publish my project anymore (which I could publish yesterday just fine).
EDIT: Correction, it seems the project was published, even though Wrangler gives me an error.
The text was updated successfully, but these errors were encountered: