Magento – Magento 2.3.4 PWA build error

magento2.3.4pwapwa-studio

I am trying to setup PWA for my local dev server hostname as http://dev-test/

Referencing for this link here:https://webkul.com/blog/magento2-3-pwa-studio-setup/

when I run build I get the following error:
sudo yarn run build:dev

yarn run v1.22.0
$ yarn venia run build:dev
$ node ./packages/pwa-buildpack/bin/buildpack load-env ./packages/venia-concept && yarn workspace @magento/venia-concept run build:dev
  ⚠  Default value for CHECKOUT_BRAINTREE_TOKEN has changed in PWA Studio Buildpack v5.0.0, due to
     confusion about whether developers should provide their own Braintree tokens for their own sites. An
     example value is provided instead for development purposes.
     Old value: sandbox_8yrzsvtm_s2bg8fs563crhqzk
     New value: undefined
     This project is using the old default value for CHECKOUT_BRAINTREE_TOKEN. Check to make sure the change
     does not cause regressions.
$ yarn run clean && yarn run validate-queries && webpack --no-progress --env.mode development
$ rimraf dist
$ yarn run download-schema && graphql validate-magento-pwa-queries --project venia
$ graphql get-schema --project venia --insecure
project venia - Schema file was created: lastCachedGraphQLSchema.json
Validating GraphQL queries in venia project...
✔ Locating schema...
✔ Finding queries in files...
✔ Validating project's queries against the schema...

Found some potential issues:

/var/www/mag-pwa/pwa-studio/packages/venia-ui/lib/components/CartPage/GiftCards/giftCardFragments.ee.js
  5:9  error  Cannot query field "applied_gift_cards" on type "Cart". Did you mean "applied_coupons"?  graphql/template-strings

/var/www/mag-pwa/pwa-studio/packages/venia-ui/lib/components/CartPage/GiftCards/giftCardQueries.js
  18:9  error  Cannot query field "giftCardAccount" on type "Query"                                                                          graphql/template-strings
  32:9  error  Cannot query field "applyGiftCardToCart" on type "Mutation". Did you mean "applyCouponToCart"?                                graphql/template-strings
  46:9  error  Cannot query field "removeGiftCardFromCart" on type "Mutation". Did you mean "removeItemFromCart" or "removeCouponFromCart"?  graphql/template-strings

/var/www/mag-pwa/pwa-studio/packages/venia-ui/lib/components/CartPage/PriceSummary/queries/giftCardSummary.ee.js
  6:9  error  Cannot query field "applied_gift_cards" on type "Cart". Did you mean "applied_coupons"?  graphql/template-strings

I am aslo getting some warning but I suposed this should be ok to build and some incompatibilities issue can't be right I am using 2.3.4:

Your versions of PWA and Magento may be incompatible.

This Venia store is from PWA Studio version 5.0.1.
Some components in PWA Studio version 5.0.1 send GraphQL queries that are only compatible with version 2.3.3 – 2.3.4 of Magento 2.

Please refer to the compatibility table in the PWA documentation for more details: https://pwastudio.io/technologies/magento-compatibility/.

Has anyone any idea what could be the issue?

Best Answer

The error indicated that the source code of your Storefront was not compatible with your M2 backend. You need to check the configuration file of the 'venia-concept' (at .../packages/venia-concept/.env) to see if your M2 backend was the one that Magento provided https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud or another one specified in your local instance.

If you're using a local M2 backend, make sure it works fine with https.

Meanwhile, we wonder if you have tried using the command @magento/create-pwa (first introduced in PWA Studio 5.0.0)? It's way easier to create a custom PWA project on top of Magento PWA Studio this way.

PS. We have put together a simple guide to set up a magento PWA Studio project using the above-mentioned command here (We did test with both PWA Studio 5.0.0 and 5.0.1)

Hope it helps.

Regards, Ubertheme team

Related Topic