Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot query field "fashion_color" #626

Closed
1 task
aathil-ali opened this issue Dec 10, 2018 · 16 comments
Closed
1 task

Cannot query field "fashion_color" #626

aathil-ali opened this issue Dec 10, 2018 · 16 comments
Labels
bug Something isn't working

Comments

@aathil-ali
Copy link

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:

@nisha-ti
Copy link

I have the same issue

@ennostuurman
Copy link
Contributor

ennostuurman commented Dec 10, 2018

@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.

@ericerway ericerway added the bug Something isn't working label Dec 10, 2018
@aathil-ali
Copy link
Author

@ennostuurman thanks

@ennostuurman
Copy link
Contributor

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

@travisdetert
Copy link

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

@ennostuurman
Copy link
Contributor

@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?

@jissereitsma
Copy link
Contributor

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.

@travisdetert
Copy link

@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.

@jissereitsma
Copy link
Contributor

jissereitsma commented Jan 23, 2019

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.

@aathil-ali
Copy link
Author

@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/

@jissereitsma
Copy link
Contributor

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

@cnu115
Copy link

cnu115 commented Jan 31, 2019

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 ???

@ennostuurman
Copy link
Contributor

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) ?

@cnu115
Copy link

cnu115 commented Feb 4, 2019

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 ??

@pratikhmehta
Copy link

pratikhmehta commented Aug 1, 2019

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.

@KrishnaK-Z
Copy link

KrishnaK-Z commented Mar 23, 2021

For configurable products, the options of type swatch need to be maintained in the separate model file. In venia, this is done in the following path
node_modules/@magento/venia-ui/lib/components/ProductOptions/getOptionType.js

so the fashion_color won't be available in magento backend and it might be the cause for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants