graphcommerce-org / graphcommerce

GraphCommerce® is a headless storefront replacement for Magento 2 (PWA), that delivers a faster, better user experience. Fully customizable (React, Next.js) and open-source.
https://www.graphcommerce.org
Other
308 stars 72 forks source link

error while yarn codegen #1406

Closed irajneeshgupta closed 2 years ago

irajneeshgupta commented 2 years ago

Provide environment information

/node_modules/@graphcommerce/mollie-magento-payment/components/MolliePaymentHandler/MolliePaymentHandler.graph ql caused error: Unable to find field "mollieProcessTransaction" on type "Mutation"! Error: Unable to validate GraphQL document! node version: v14.19.1

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Following Your Readme file

Describe the Bug

note that i have tested it on local magento 2.4.4 instance and it failed to compile. yarn codegen /node_modules/@graphcommerce/mollie-magento-payment/components/MolliePaymentHandler/MolliePaymentHandler.graph ql caused error: Unable to find field "mollieProcessTransaction" on type "Mutation"! Error: Unable to validate GraphQL document! node version: v14.19.1

Expected Behavior

It should generate all required files.

To Reproduce

note that i have tested it on local magento 2.4.4 instance and it failed to compile. yarn codegen /node_modules/@graphcommerce/mollie-magento-payment/components/MolliePaymentHandler/MolliePaymentHandler.graph ql caused error: Unable to find field "mollieProcessTransaction" on type "Mutation"! Error: Unable to validate GraphQL document! node version: v14.19.1

irajneeshgupta commented 2 years ago

It can be due to latest release have support for mollie payments but in vanilla magento mollie is not there.

paales commented 2 years ago

We're still improving in this area, but you need to remove unused PSP's from the codebase as mentioned here: https://www.graphcommerce.org/docs/getting-started/create#remove-unused-psps

irajneeshgupta commented 2 years ago

after adding mollie payments , it worked as expected! @paales can you guide me to overcome cors issue i am facing while add to cart from graphcommerce. since it mutates empty cart , and it breaked due to cors ..not allowing I am using magento2 on local and its graphql serving from another host i know its a general issue but i am stucked at this

image

paales commented 2 years ago

I think you have configured the NEXT_PUBLIC_GRAPHQL_ENDPOINT to point to your local backend? That should be set to the default value: https://github.com/graphcommerce-org/graphcommerce/blob/main/examples/magento-graphcms/.env.example#L8

Make sure you have configured your http://magento244.local/graphql URL in MAGENTO_ENDPOINT: https://github.com/graphcommerce-org/graphcommerce/blob/main/examples/magento-graphcms/.env.example#L5

Does that solve the issue?

irajneeshgupta commented 2 years ago

@paales thanks It worked as expected but very slow , may be its due to dev mode.

  1. I want to check this in production. how can we achieve it as i could not find any doc? In other storefronts like venia we use magento2-upward-connector to serve all requests to upward-php. Stores > Configuration > General > Web > UPWARD PWA Configuration to pass upward.yml

2.Is there a way to whitelist api urls for magento like we use shipstation so the "auctane/api" should not be aquired by graphcommerce.

paales commented 2 years ago

@irajneeshgupta During dev mode it will need to compile all the pages etc so a slowdown is expected. Also it of course depends on your backend, make sure your caches are enabled. If you try and run yarn build && yarn start you can experience the performance during production mode.

  1. To read how to deploy the application: https://www.graphcommerce.org/docs/framework/deployment In the end it is a nextjs application so advice for nextjs also applies to GraphCommerce: https://nextjs.org/docs/deployment

  2. You usually interact with the Magento backend via GraphQL. If you want to use a specific Magento URL so they are accsesible via the frontend, you can use https://nextjs.org/docs/api-reference/next.config.js/rewrites#rewriting-to-an-external-url

In the end it would be best for the plugin to support GraphQL as integrations are much easier to make, you should ask them :)

irajneeshgupta commented 2 years ago

thanks for your help @paales Its working super fast 🚀🚀 on vercel deployment.