Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.39k stars 1.98k forks source link

Jetpack Cloud: cannot fetch plugins on a site where the JSON API module is disabled #90218

Open jeherve opened 2 months ago

jeherve commented 2 months ago

Quick summary

When fetching plugins for a site where the JSON API module is disabled, one only receives an error.

Steps to reproduce

  1. Start with a site that's connected to WordPress.com.
  2. Go to Jetpack > Settings > Modules in wp-admin, and disable the JSON API module.
  3. Go to https://cloud.jetpack.com/plugins/manage/yoursite.com

What you expected to happen

I expected to see a list of the different plugins installed on the site.

What actually happened

Instead I only get a "No plugins found." error. When looking at the API requests on that page, I see that the rest/v1.1/sites/site_id/plugins request returns a 403: "API calls to this blog have been disabled."

The request should always be available in Calypso.

One can see the expected result when running the same request in https://developer.wordpress.com/docs/api/console/

It returns the plugins installed on the site.

Impact

Some (< 50%)

Available workarounds?

No and the platform is unusable

Platform (Simple and/or Atomic)

Atomic, Self-hosted

Logs or notes

No response

jeherve commented 2 months ago

@Automattic/jetpack-avalon Is that something that would fall on Avalon's radar?

Thank you!

atanas-dev commented 2 months ago

@vitozev I believe plugin management in Jetpack Cloud falls under the Genesis umbrella?

vitozev commented 2 months ago

We ported over the implementation from WP.com (as technically plugins/manage/:site exists on WP.com as well) to the Jetpack Cloud. @rcanepa do you think this is something we could prioritize now (given the A4A public, etc.)?

@jeherve, to solve this problem, do we need to use the REST API endpoints (the ones available in Core)?

jeherve commented 2 months ago

to solve this problem, do we need to use the REST API endpoints (the ones available in Core)?

No, you should be able to continue to use the existing v1 /plugins endpoint. It seems that only authentication needs to be fixed. It works in the Developer Console for example, and also works in Calypso blue:

Here is a screenshot of a fresh JN site:

Developer console

image

calypso blue

image

calypso green

image
rcanepa commented 2 months ago

@vitozev, it isn't a high priority, but if someone on Genesis is working on maintenance tasks this week, feel free to assign it to that person. Eventually, we will have to fix it either way.

andrii-lysenko commented 2 months ago

Just a small update here. It seems that issue actually touches many v1.1/sites endpoints, including some used in A4A.

'/sites/%s',
'/sites/%s/updates',
'/sites/%s/posts/',
'/sites/%s/taxonomies/%s/terms',
'/sites/%s/post-types',
'/sites/%s/post-formats',
'/sites/%s/post-types/%s/taxonomies',
'/sites/%s/media/%d',
'/sites/%s/settings'

It probably works in https://developer.wordpress.com/docs/api/console/ for a8c users only. I assume it was a small typo at some point and this should fix it: D148212-code