Skip to content
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

Unsupported report format. Expected JSON. #1204

Closed
XhmikosR opened this issue Dec 21, 2016 · 13 comments
Closed

Unsupported report format. Expected JSON. #1204

XhmikosR opened this issue Dec 21, 2016 · 13 comments
Labels

Comments

@XhmikosR
Copy link
Contributor

XhmikosR commented Dec 21, 2016

So, I'm getting Unsupported report format. Expected JSON. when trying to upload my json report to http://googlechrome.github.io/lighthouse/viewer/

C:\Users\xmr\Desktop>node -v && npm -v
v6.9.2
3.10.9

C:\Users\xmr\Desktop>lighthouse --output=json --output-path=results.json https://www.bootstrapcdn.com/

I tried with Firefox 51.0b9 64-bit and Chrome 55.0.2883.87 m (64-bit). Here is the zipped json report file.

Note that Chrome isn't being killed at the end so I have to close it manually. Not sure if this is related, i.e. lighthouse writes more stuff after that step. If it does, then it would explain the error.

@XhmikosR
Copy link
Contributor Author

OK, it's not because Chrome isn't being killed. I used #1206 which kills Chrome at the end, yet my report still shows as invalid.

https://dl.dropboxusercontent.com/u/3607425/results-1206.zip

Also, the output is valid JSON, so, I'm not sure why the viewer is complaining :/

@ebidel ebidel added the viewer label Dec 21, 2016
@ebidel
Copy link
Contributor

ebidel commented Dec 21, 2016

I was able to drop your json file onto the app without any issues. Is it possible you have an extension that's interfering?

@XhmikosR
Copy link
Contributor Author

XhmikosR commented Dec 22, 2016

Nope, I don't have any extensions in Chrome or Firefox.

Even Microsoft Edge has the same issue.

Can this be due to the OS that is Windows?

@ebidel
Copy link
Contributor

ebidel commented Dec 22, 2016

Yea it could be. I don't have a windows machine handy to test atm. Windows might have different idiosyncrasies with drag and drop from outside the browser.

If you click on the center logo, it should open a hidden file input. Does that work for you?

@XhmikosR
Copy link
Contributor Author

Nope, both fail.

@ebidel
Copy link
Contributor

ebidel commented Dec 22, 2016

Shucks. If you have the source checked out, it would be very helpful if you could log what file.type is here: https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-viewer/app/src/lighthouse-report-viewer.js#L193

git clone https://github.com/GoogleChrome/lighthouse

cd lighthouse
npm install

# The CLI is authored in TypeScript and requires compilation:
cd lighthouse-cli
npm install
npm run build

cd ..

npm run fast -- --output=json --output-path=results.json https://www.bootstrapcdn.com/

@XhmikosR
Copy link
Contributor Author

I might try to debug it tomorrow but from what I see there's only one relevant line in https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-viewer/app/src/fileuploader.js#L45

@XhmikosR
Copy link
Contributor Author

OK I managed to debug this.

>> file: File { name: "results-1206.json", lastModified: 1482319408014, lastModifiedDate: Date 2016-12-21T11:23:28.014Z, webkitRelativePath: "", size: 2238109, type: "" }  main.js:1083:13
>> file.type:   main.js:1084:13
>> typeof file.type: string

So file.type is empty string.

@XhmikosR
Copy link
Contributor Author

XhmikosR commented Dec 22, 2016

If I remove the type check the report shows fine.

screen shot 2016-12-22 at 02 32 11-fullpage

So we need to figure out why type is empty.

@ebidel
Copy link
Contributor

ebidel commented Dec 22, 2016

Just to be clear, when you say "Nope, both fail.", the case for clicking the file input still allows you to select a .json file. Right? Meaning https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-viewer/app/src/fileuploader.js#L45 works, but it fails at https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-viewer/app/src/lighthouse-report-viewer.js#L193.

We could work around this by checking the file extension if the type is empty.

@XhmikosR
Copy link
Contributor Author

XhmikosR commented Dec 22, 2016

Yeah, I can upload the report just fine; it just throws the error since file.type is empty string.

I'm not sure just looking at the file extension is safe though. That is something you guys should check.

@ebidel
Copy link
Contributor

ebidel commented Dec 22, 2016

We'll put some time into figuring out what's going on on windows. Thanks for you help!

@brendankenny
Copy link
Member

fixed in #1234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants