Open nickdaugherty opened 4 years ago
~Marking this for 8.7 as we need to have a fix in the next release. This is causing issues for some VIP Go clients.~
We have a WP.com workaround for Go sites. The conditions needed (-1
blog_public
option) is not yet possible for sites other than Atomic or Go, so this is not urgent.
Still need to fix it to support third-party private sites with a Jetpack connection.
If 16184 is merged, to test this, would need to mock a 200 status code response that does not return an array or, probably easier, revert 16184 for the sake of testing with the instructions above.
This issue has been marked as stale. This happened because:
No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.
It appears that reproducing the error here can currently be done by changing https://github.com/Automattic/jetpack/blob/b927b0492c265811198f6d6f2a923763317a471c/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-site-endpoints.php#L58 to something like
'data' => '"XXXX"',
The .filter()
call in question appears to be https://github.com/Automattic/jetpack/blob/b927b0492c265811198f6d6f2a923763317a471c/projects/plugins/jetpack/_inc/client/state/site/reducer.js#L361-L363
OTOH, I'm not sure this is all that worth worrying about. The JS should be able to assume that the API endpoint returns a value structured according to its specification when it returns a successful response. Does that specification allow for not having whatever array it's trying to filter?
Steps to reproduce the issue
blog_public
option to-1
)/wp-admin/admin.php?page=jetpack#/dashboard
That ultimately comes from
fetchSitePurchases
which hits thewp-json/jetpack/v4/site/purchases
endpoint, which has a bug where it returns an incorrect response for failed upstream requests (see #16067).Regardless of #16067, the JS code here should be defensive and only call
.filter()
if the data is an array.What I expected
To see the JP dashboard
What happened instead
The dashboard went kablamo.