Pwa-studio: Cannot query field "fashion_color"

Created on 10 Dec 2018  Â·  15Comments  Â·  Source: magento/pwa-studio

This issue is a:

  • [ ] Documentation issue

Environment

| Question | Answer |
| --------------------------- | :-----------: |
| Magento version |2.3.0 |
| Operating System + version | Ubuntu 16.04 |
| node.js version (node -v) | 10.14.1 |
| npm version (npm -v) | 6.4.1 |

Description

Using environment variables from .env
Errors found!

/var/www/html/magento223/pwa-studio/packages/venia-concept/src/queries/getProductDetail.graphql
37:25 error Cannot query field "fashion_color" on type "SimpleProduct" graphql/template-strings

/var/www/html/magento223/pwa-studio/packages/venia-concept/src/RootComponents/Product/Product.js
48:29 error Cannot query field "fashion_color" on type "SimpleProduct" graphql/template-strings

✖ 2 problems (2 errors, 0 warnings)

These errors may indicate:

  • an out-of-date Magento 2.3 codebase running at "http://magento223.local/"
  • an out-of-date project codebase whose queries need updating

Use GraphiQL or another schema exploration tool on the Magento store to learn more.

Expected result:

run pwa

Possible solutions:

bug

Most helpful comment

@aliaathil this is the GraphQL query validation which runs with npm run build and npm watch:venia .

This happens because you're running against a Magento instance that has no Venia sample data and because the Venia GraphQL queries for product options fashion_color and fashion_size are hardcoded.

Comment out fashion_color and fashion_size in both packages/venia-concept/src/queries/getProductDetail.graphql and packages/venia-concept/src/RootComponents/Product/Product.js and you will be able run npm run build and npm run watch:venia with a custom Magento 2.3 instance.

All 15 comments

I have the same issue

@aliaathil this is the GraphQL query validation which runs with npm run build and npm watch:venia .

This happens because you're running against a Magento instance that has no Venia sample data and because the Venia GraphQL queries for product options fashion_color and fashion_size are hardcoded.

Comment out fashion_color and fashion_size in both packages/venia-concept/src/queries/getProductDetail.graphql and packages/venia-concept/src/RootComponents/Product/Product.js and you will be able run npm run build and npm run watch:venia with a custom Magento 2.3 instance.

@ennostuurman thanks

yw @aliaathil glad it helped and thanks for closing the issue .

This is closed, but this happens with the default 2.3 and pwa repos I downloaded yesterday...

@travisdetert what do you mean with default 2.3 . Is that a default M2.3 instance (with default Magento sample data) or the PWA MAGENTO_BACKEND_URL="https://release-dev-rxvv2iq-zddsyhrdimyra.us-4.magentosite.cloud/" (see packages/venia-concept/.env.dist ) with Venia sample data?

I'm bumping into the same issue, while the attribute fashion_color exists as an EAV attribute (as being part of the demo data). As far as I understood the GraphQL API, it would require a custom (Venia?) module to explicitly add this EAV attribute to the GraphQL schema (see https://devdocs.magento.com/guides/v2.3/graphql/ for mentioning of this).

The module magento/module-catalog-sample-data-venia would be ideal for this.

@ennostuurman that is correct, I followed the install directions per the docs with the newly downloaded packages (at the time), I had to run install a few times to get it to install the sample data, but when that did seem to add products, I saw different results than the online demo. Not saying it's impossible that I didn't miss a step, but I am pretty sure I followed it line for line. Commenting out those fields got me closer to what looked like a working site, but was missing various images or products in comparison.

A module - say magento/module-catalog-sample-data-venia will need to add a file etc/schema.graphqls file with the following contents:

interface ProductInterface {
    fashion_color: String @doc(description: "Fashion color.")
}

This theoretically should be it. However, I'm still struggling with it.

@jissereitsma I think you have not installed sample data or had some errors in while installing
please follow the steps
https://magento-research.github.io/pwa-studio/venia-pwa-concept/install-sample-data/

I actually found that files in my venia/dist/js folder were still pointing to an old setup. Fixed it for myself anyway.

I commented "fashion_color" and "fashion_size" then build was running successfully but in PDP( product detailed page ) page item color and size, unable to add to the cart.
For this any solution ???

hey @cnu115 if you're running against a Magento instance with Venia sample data then commenting out the variants in the GraphQL query will indeed error when trying to add products to cart.

So are you running Magento PWA Studio against a local Magento instance with Venia data?

If that's the case does your local PWA Studio also have these issues with the default configured MAGENTO_BACKEND_URL (see env.dist) ?

Hi @ennostuurman I am not running Venia sample data, I am running Magento sample data.

For default configured MAGENTO_BACKEND_URL working fine. For Magento sample data it's throwing an error item is undefined.
Venia sample data having only configurable products.

What about store having simple products as well as configurable products ??

Hello friends,

I need your help.

I got an error "failed: ServerParseError: Unexpected token < in JSON at position 0\n at makePromise.then.catch.e". while i run yarn run watch:venia

Thanks in advance.

Was this page helpful?
0 / 5 - 0 ratings