achievements-app / psn-api

A JavaScript library that lets you get trophy, user, and game data from the PlayStation Network.
https://psn-api.achievements.app
MIT License
273 stars 32 forks source link

FetchError: Invalid json response body #97

Closed gamerxsocietydev closed 2 years ago

gamerxsocietydev commented 2 years ago

I have this error being returned after following the get started process. I have updated the npsso code multiple times and am still getting the same error no matter what changes i make. Please help

unhandledRejection: FetchError: invalid json response body at https://m.np.playstation.net/api/search/v1/universalSearch

FunkeyFlo commented 2 years ago

It's looking like the v1 api has been killed / changed by sony. All routes (that I've used) seem to be returning 403 errors.

edit: I should have been more specific 😅

wescopeland commented 2 years ago

Major bummer. Should all v1 routes be deprecated / removed?

FunkeyFlo commented 2 years ago

Not quite sure yet. Maybe best to wait until tomorrow to be absolutely sure. I've also not tested all routes so more might be affected. Authentication (npsso) process still seems to work though.

wescopeland commented 2 years ago

Just also verified auth works. Agreed -- let's wait for 24 hours and then iterate through what's working and not. makeUniversalSearch is definitely a legacy endpoint and so it makes sense Sony might kill that one off.

wescopeland commented 2 years ago

Also @FunkeyFlo -- cool project using psn-api!

FunkeyFlo commented 2 years ago

userProfile/v1/internal/users is also affected, I was using it to track activities in my home automation app.

wescopeland commented 2 years ago

Understood, I believe that would impact:

This would probably have been killed off due to the internal designation in the path, but unfortunate nonetheless. I will test these and makeUniversalSearch() in 24 hours and see if they're still non-functional, and if so we'll have to remove them from the library.

Definitely open to ideas how to replace the implementation of these functions.

wescopeland commented 2 years ago

FYI: https://github.com/Tustin/psn-php/issues/217 https://github.com/Tustin/psn-php/commit/16032a352b78057bbda03bf956167003570d4cc2

wescopeland commented 2 years ago

The solution in the linked commit fixes makeUniversalSearch(), getProfileFromAccountId(), and getUserFriendsAccountIds(). I am about to push a release with this hotfix.

sammyke007 commented 2 years ago

So .net changed to .com?!

wescopeland commented 2 years ago

For "m.np.playstation", yes 🫡

wescopeland commented 2 years ago

Thank you for reporting this issue. 2.8.1 has been released with a hotfix. I would like to keep this ticket open for 24hrs in the event Sony does something wild with the new TLD we've switched to.

You will need to update to 2.8.1 of psn-api to continue using most functions.

gamerxsocietydev commented 2 years ago

@wescopeland The hot fix from earlier fixed each file except for the "TROPHY_BASE_URL.d.ts" file, which is still causing issues when retrieving user trophy information.

Error Message Reads -> FetchError: invalid json response body at https://m.np.playstation.net/api/trophy/v1/users/web3_architect/trophySummary reason: Unexpected token < in JSON at position 0 ....

I would also like to request help from someone proficient with this repo to get me set back up properly. That would be amazing. Been struggling these past couples of days with making the correct API calls

wescopeland commented 2 years ago

@wescopeland The hot fix from earlier fixed each file except for the "TROPHY_BASE_URL.d.ts" file, which is still causing issues when retrieving user trophy information.

Whoops, this should now be fixed in 2.8.1. Sorry about that.

gamerxsocietydev commented 2 years ago

The update to psn-api 2.81 worked!! Thank you very much @wescopeland you are amazing!

wescopeland commented 2 years ago

I think the dust has settled and it's safe to close this issue at this point.

If you are experiencing this issue, upgrading to 2.8.1 should fix it.