0

I'm facing an issue where my 2.4.5 https://<magentostore>/graphql endpoint is returning a 404. After some research it seems that none of the Magento GraphQl packages are installed by composer. My store is running on Magento 2.4.5 for some time now. This issue is present on both my development and production server.

My composer.json file contains all of the GraphQl modules within the "replace" object. Taken from the default Magento 2.4.5 composer.json file.

No errors come up during composer install. I've tried removing the vendor folder and re-installing all packages. As shown in my screenshot, the magento/module-graph-ql is also present in my composer.lock file.

I'm guessing this is not entirely Magento related, since it is about missing packages in my vendor folder. But the odd thing about this is, none of the Magento GraphQl packages are installed. Magento itself is running fine on 2.4.5 for some time already. So apparently it's fine that it is missing GraphQL core files.

Any suggestions on how to debug why packages listed in the package.lock are not actually installed in the vendor folder?

I'm also not using any modules to disable Magento core modules.

Any help is appreciated.

Packages showing in composer.lock, but not present in vendor folder

404 error showing, as it if is just a mistyped cms page

1 Answer 1

0

Welcome to Magento Stack Exchange!

You have accidentally used configuration to remove composer packages for GraphQL, where the package config is located in the replace node and the version is set to *:

"replace": {
    "magento/module-graph-ql": "*",
    "magento/module-graph-ql-cache": "*",
    ...
}

To bring GraphQL composer packages back to your project, you need to remove these configurations and run the command

composer install

After that, you must run bin/magento setup:upgrade, recompile code, and redeploy static content.

3
  • If you had any issues related to this topic, feel free to let me know. I'll try to help.
    – Tu Van
    Commented Jun 1, 2023 at 17:14
  • Thanks. This was indeed the problem. Guess I'm still not entirely sure if I understand the replace object. Why does the default Magento 2.4.5 composer.json have "magento/module-graph-ql": "100.4.5" and "magento/module-graph-ql-cache": "100.4.2" defined? And why does removing these lines entirely solve the issue in my case? Commented Jun 5, 2023 at 7:09
  • The config for the composer.json file is different between the source code in the Github repository vs the source code you installed via composer. Setup Magento using the GitHub repository is recommended for contributors who submit the changes to Magento core via the Magento GitHub Repository. Regarding your case, your config is "magento/module-graph-ql": "*" instead of a specific version, that why this package was removed.
    – Tu Van
    Commented Jun 5, 2023 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.