craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.27k stars 635 forks source link

[4.x]: Can't access Craft Plugin Store: "The Plugin Store is not available, please try again later." #11776

Closed lukastransom closed 2 years ago

lukastransom commented 2 years ago

What happened?

Description

After a Craft 3 → Craft 4 migration, my site can no longer access the Craft Plugin Store from the control panel. I receive the following error:

The Plugin Store is not available, please try again later.

Looking at the browser console, I also see the following errors (though they appear on every page, not just the Plugin Store):

Screen Shot 2022-08-12 at 16 51 23
{
  "message": "Request failed with status code 404",
  "name": "AxiosError",
  "code": "ERR_BAD_REQUEST",
  "config": {
    "transitional": {
      "silentJSONParsing": true,
      "forcedJSONParsing": true,
      "clarifyTimeoutError": false
    },
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "timeout": 0,
    "xsrfCookieName": "XSRF-TOKEN",
    "xsrfHeaderName": "X-XSRF-TOKEN",
    "maxContentLength": -1,
    "maxBodyLength": -1,
    "env": {
      "FormData": null
    },
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Content-Type": "application/json",
      "X-Requested-With": "XMLHttpRequest",
      "X-Registered-Asset-Bundles": ",craft\\web\\assets\\pluginstore\\PluginStoreAsset,craft\\web\\assets\\cp\\CpAsset,craft\\web\\assets\\tailwindreset\\TailwindResetAsset,craft\\web\\assets\\axios\\AxiosAsset,craft\\web\\assets\\d3\\D3Asset,craft\\web\\assets\\elementresizedetector\\ElementResizeDetectorAsset,craft\\web\\assets\\focusvisible\\FocusVisibleAsset,craft\\web\\assets\\garnish\\GarnishAsset,yii\\web\\JqueryAsset,craft\\web\\assets\\jquerytouchevents\\JqueryTouchEventsAsset,craft\\web\\assets\\velocity\\VelocityAsset,craft\\web\\assets\\jqueryui\\JqueryUiAsset,craft\\web\\assets\\jquerypayment\\JqueryPaymentAsset,craft\\web\\assets\\datepickeri18n\\DatepickerI18nAsset,craft\\web\\assets\\picturefill\\PicturefillAsset,craft\\web\\assets\\selectize\\SelectizeAsset,craft\\web\\assets\\fileupload\\FileUploadAsset,craft\\web\\assets\\xregexp\\XregexpAsset,craft\\web\\assets\\fabric\\FabricAsset,craft\\web\\assets\\iframeresizer\\IframeResizerAsset,craft\\web\\assets\\vue\\VueAsset",
      "X-Registered-Js-Files": ",https://js.stripe.com/v2/,https://my-craft4-site.com/cpresources/5bd1cb10/tailwind_reset.js?v=1660333249,https://my-craft4-site.com/cpresources/6cbddddc/axios.js?v=1660333249,https://my-craft4-site.com/cpresources/4ab9f533/d3.js?v=1660333249,https://my-craft4-site.com/cpresources/8b97f8d8/element-resize-detector.js?v=1660333249,https://my-craft4-site.com/cpresources/527760e1/focus-visible.js?v=1660333249,https://my-craft4-site.com/cpresources/8e77e730/jquery.js?v=1660333249,https://my-craft4-site.com/cpresources/d88a939a/jquery.mobile-events.js?v=1660333249,https://my-craft4-site.com/cpresources/dd4e4e4f/velocity.js?v=1660333249,https://my-craft4-site.com/cpresources/32e64a99/garnish.js?v=1660333249,https://my-craft4-site.com/cpresources/84907726/jquery-ui.js?v=1660333249,https://my-craft4-site.com/cpresources/d8d94cf8/jquery.payment.js?v=1660333249,https://my-craft4-site.com/cpresources/e4829626/picturefill.js?v=1660333249,https://my-craft4-site.com/cpresources/5cc47132/selectize.js?v=1660333249,https://my-craft4-site.com/cpresources/9aeba18d/jquery.fileupload.js?v=1660333249,https://my-craft4-site.com/cpresources/ef3a2b26/xregexp-all.js?v=1660333249,https://my-craft4-site.com/cpresources/1a547d8e/fabric.js?v=1660333249,https://my-craft4-site.com/cpresources/41d8fc84/iframeResizer.js?v=1660333249,https://my-craft4-site.com/cpresources/508cd37a/cp.js?v=1660333249,https://my-craft4-site.com/cpresources/c96e9614/vue.js?v=1660333366,https://my-craft4-site.com/cpresources/59f7e307/js/app.js?v=1660333366",
      "X-CSRF-Token": "UUIl6nYVTNL_uzulaPdxdN-wvqGyICdZonxGGyZCfn9uBcdDORDJHN0-wQAnUXbRwXWevfWjXGW9P80pzzrcgDHHpjlNw9Y7qlehs1l5DVc7tUF0ciGrsC_ZnbVSAZ4JQZnMGCUHRJ9n9F4kOkhSWWLgx6j2rtHWXrMQQMNEmPv47lis7yEqGwyFGqacJaeL2TCHInBLmQ8sKYeb4lDnAbMAG-zdjNLxchN0_TErIlNvOA4qULIvY0XkS6EP9TRCNxfg-Ub73sWUZQPfCftNqgrr5AHwl1x1obcImmGQhDhMOTIMg3NMFxTN1ky4pdRqNK05car8KRFhdPtSh2xKSTFrPDeEnsO0x5WnMYB9crAHys_VsRXB1lQHXX3BT9Pwf_Kmjky2"
    },
    "data": "{\"path\":\"plugin-store\"}",
    "method": "post",
    "url": "https://my-craft4-site.com/index.php?p=admin%2Factions%2Fapp%2Fget-cp-alerts",
    "params": {
      "v": 1660347812518
    }
  },
  "request": {},
  "response": {
    "data": {
      "message": "Page not found.",
      "error": "Page not found."
    },
    "status": 404,
    "statusText": "Not Found",
    "headers": {
      "cache-control": "no-cache, no-store, must-revalidate",
      "content-encoding": "gzip",
      "content-security-policy": "frame-ancestors 'self'",
      "content-type": "application/json; charset=UTF-8",
      "date": "Fri, 12 Aug 2022 23:43:32 GMT",
      "expires": "0",
      "pragma": "no-cache",
      "server": "nginx",
      "vary": "Accept-Encoding",
      "x-content-type-options": "nosniff",
      "x-firefox-spdy": "h2",
      "x-frame-options": "SAMEORIGIN",
      "x-powered-by": "Craft CMS",
      "x-robots-tag": "none"
    },
    "config": {
      "transitional": {
        "silentJSONParsing": true,
        "forcedJSONParsing": true,
        "clarifyTimeoutError": false
      },
      "transformRequest": [
        null
      ],
      "transformResponse": [
        null
      ],
      "timeout": 0,
      "xsrfCookieName": "XSRF-TOKEN",
      "xsrfHeaderName": "X-XSRF-TOKEN",
      "maxContentLength": -1,
      "maxBodyLength": -1,
      "env": {
        "FormData": null
      },
      "headers": {
        "Accept": "application/json, text/plain, */*",
        "Content-Type": "application/json",
        "X-Requested-With": "XMLHttpRequest",
        "X-Registered-Asset-Bundles": ",craft\\web\\assets\\pluginstore\\PluginStoreAsset,craft\\web\\assets\\cp\\CpAsset,craft\\web\\assets\\tailwindreset\\TailwindResetAsset,craft\\web\\assets\\axios\\AxiosAsset,craft\\web\\assets\\d3\\D3Asset,craft\\web\\assets\\elementresizedetector\\ElementResizeDetectorAsset,craft\\web\\assets\\focusvisible\\FocusVisibleAsset,craft\\web\\assets\\garnish\\GarnishAsset,yii\\web\\JqueryAsset,craft\\web\\assets\\jquerytouchevents\\JqueryTouchEventsAsset,craft\\web\\assets\\velocity\\VelocityAsset,craft\\web\\assets\\jqueryui\\JqueryUiAsset,craft\\web\\assets\\jquerypayment\\JqueryPaymentAsset,craft\\web\\assets\\datepickeri18n\\DatepickerI18nAsset,craft\\web\\assets\\picturefill\\PicturefillAsset,craft\\web\\assets\\selectize\\SelectizeAsset,craft\\web\\assets\\fileupload\\FileUploadAsset,craft\\web\\assets\\xregexp\\XregexpAsset,craft\\web\\assets\\fabric\\FabricAsset,craft\\web\\assets\\iframeresizer\\IframeResizerAsset,craft\\web\\assets\\vue\\VueAsset",
        "X-Registered-Js-Files": ",https://js.stripe.com/v2/,https://my-craft4-site.com/cpresources/5bd1cb10/tailwind_reset.js?v=1660333249,https://my-craft4-site.com/cpresources/6cbddddc/axios.js?v=1660333249,https://my-craft4-site.com/cpresources/4ab9f533/d3.js?v=1660333249,https://my-craft4-site.com/cpresources/8b97f8d8/element-resize-detector.js?v=1660333249,https://my-craft4-site.com/cpresources/527760e1/focus-visible.js?v=1660333249,https://my-craft4-site.com/cpresources/8e77e730/jquery.js?v=1660333249,https://my-craft4-site.com/cpresources/d88a939a/jquery.mobile-events.js?v=1660333249,https://my-craft4-site.com/cpresources/dd4e4e4f/velocity.js?v=1660333249,https://my-craft4-site.com/cpresources/32e64a99/garnish.js?v=1660333249,https://my-craft4-site.com/cpresources/84907726/jquery-ui.js?v=1660333249,https://my-craft4-site.com/cpresources/d8d94cf8/jquery.payment.js?v=1660333249,https://my-craft4-site.com/cpresources/e4829626/picturefill.js?v=1660333249,https://my-craft4-site.com/cpresources/5cc47132/selectize.js?v=1660333249,https://my-craft4-site.com/cpresources/9aeba18d/jquery.fileupload.js?v=1660333249,https://my-craft4-site.com/cpresources/ef3a2b26/xregexp-all.js?v=1660333249,https://my-craft4-site.com/cpresources/1a547d8e/fabric.js?v=1660333249,https://my-craft4-site.com/cpresources/41d8fc84/iframeResizer.js?v=1660333249,https://my-craft4-site.com/cpresources/508cd37a/cp.js?v=1660333249,https://my-craft4-site.com/cpresources/c96e9614/vue.js?v=1660333366,https://my-craft4-site.com/cpresources/59f7e307/js/app.js?v=1660333366",
        "X-CSRF-Token": "UUIl6nYVTNL_uzulaPdxdN-wvqGyICdZonxGGyZCfn9uBcdDORDJHN0-wQAnUXbRwXWevfWjXGW9P80pzzrcgDHHpjlNw9Y7qlehs1l5DVc7tUF0ciGrsC_ZnbVSAZ4JQZnMGCUHRJ9n9F4kOkhSWWLgx6j2rtHWXrMQQMNEmPv47lis7yEqGwyFGqacJaeL2TCHInBLmQ8sKYeb4lDnAbMAG-zdjNLxchN0_TErIlNvOA4qULIvY0XkS6EP9TRCNxfg-Ub73sWUZQPfCftNqgrr5AHwl1x1obcImmGQhDhMOTIMg3NMFxTN1ky4pdRqNK05car8KRFhdPtSh2xKSTFrPDeEnsO0x5WnMYB9crAHys_VsRXB1lQHXX3BT9Pwf_Kmjky2"
      },
      "data": "{\"path\":\"plugin-store\"}",
      "method": "post",
      "url": "https://my-craft4-site.com/index.php?p=admin%2Factions%2Fapp%2Fget-cp-alerts",
      "params": {
        "v": 1660347812518
      }
    },
    "request": {}
  }
}

Steps to reproduce

  1. Login to Craft 4 site
  2. Click on "Plugin Store" from the control panel's side bar
  3. Error

Expected behavior

Be able to load, view, purchase plugins from the Plugin Store

Actual behavior

Error: The Plugin Store is not available, please try again later.

I've sent all the project files to support@craftcms.com. Any help in understanding this would be greatly appreciated. Thanks!

Craft CMS version

4.2.1.1

PHP version

8.1.8

Operating system and version

Ubuntu 20.04.4 LTS

Database type and version

MySQL 8.0.30

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.10-23)

Installed plugins and versions

"require": {
    "craftcms/cms": "^4.0.3",
    "craftcms/redactor": "^3.0.2",
    "newism/craft3-fields": "^2.0",
    "nystudio107/craft-seomatic": "^4.0",
    "nystudio107/craft-vite": "^4.0.1",
    "sebastianlenz/linkfield": "^2.1.3-rc",
    "vaersaagod/dospaces": "^2.0",
    "verbb/navigation": "^2.0.3",
    "verbb/super-table": "^3.0.0-beta.6",
    "vlucas/phpdotenv": "^5.4.0"
  },
angrybrad commented 2 years ago

This ended up being because there was a custom module with the handle of app that was being bootstrapped:

'modules' => [
    'app' => \modules\Module::class,
  ],

Which, with the way controller routing works, meant that any requests that needed to use Craft's AppController (like the Plugin Store) were getting sent to the custom module.

Renaming the module handle resolved it.

For posterity, probably worth mentioning that there would be a similar naming conflict issue with any of Craft's other controllers as well. https://github.com/craftcms/cms/tree/develop/src/controllers