-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Invalid JSON format on toepoke.co.uk manifest.json #1702
Comments
As far as I can tell LH is using the standard Might be worth looking into https://github.com/sindresorhus/strip-bom/blob/master/index.js |
Not sure what the correct thing to do here is. A BOM is an invalid character in JSON, but in some cases clients will drop the BOM before attempting to parse. At the very least we could warn that the first character is a BOM to give a better error message, though. If I test (on a non-Windows machine) a manifest saved with a BOM, the application panel in devtools lists no information for the manifest. Since IIUC devtools is exposing what Chrome has actually parsed from the manifest, this implies Chrome doesn't understand the manifest either (devtools does not report a JSON SyntaxError, though, or any error at all). If the browser doesn't understand it, we should definitely mark it as an error, just with a better error message. OTOH, (one of?) the native Chrome JSON parser(s) explicitly skips BOMs when encountered. Not sure how that interacts with the manifest parser. |
HI @brendankenny, To confirm when I was saving with BOM I didn't see the manifest parameters in DevTools. They magically start appearing when saved without BOM - which is in line with what you're seeing. If it's not feasible to raise an error, perhaps a warning that always appears in the report would be sufficient? I'm just conscious of others falling into the same issue. If I can be of any assistance, please give me a shout. |
IMO, we shouldn't do something special. It's an error in the parser so Chrome will not load it as I understand it. |
on devtools there are no warnings or errors. my wpa has been also working
fine (offline etc) with a "utf-8 with signature" manifest. only changed it
to non-signature because of this lighthouse issue.
…On Fri, Mar 3, 2017, 1:50 PM Paul Irish ***@***.***> wrote:
@toepoke <https://github.com/toepoke> when you look at the manifest panel
in devtools, do you see warnings or errors?
[image: image]
<https://cloud.githubusercontent.com/assets/39191/23564521/1da6a2a2-ffff-11e6-89ac-42c28e374f44.png>
also same question for @zmandel <https://github.com/zmandel>, as it seems
like a related issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1702 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEKdJ5PWEhGZLgapxciS76sP3ZWSbSbVks5riGD5gaJpZM4L-dPz>
.
|
HI @paulirish , Nothing appears in the console. The manifest is devtools is just blank when saved with BOM: Hope this helps. |
perhaps it's more like a chrome issue where it should tell that it's invalid. |
There is an open issue for the dev tools where i added the comment that there should be an info text (would have saved us a few debug hours :-) |
@HolgerJeromin thank you for reporting to devtools. I'll update lighthouse to check |
Fixed on master |
Hi,
When running the report I get the following error:
"ERROR: file isn't valid JSON: SyntaxError: Unexpected token in JSON at position 0"
It's been driving me mental for weeks! Turns out it's because the manifest.json was saved with a byte-order-mark (I'm on Windows). Saved without the BOM and all works well.
May I suggest adding a warning to the documentation so others don't have a similar battle?
Many thanks,
Franz.
The text was updated successfully, but these errors were encountered: