Error: GraphQL error: ProductVariantUpdate access denied

jbk
New Member
4 0 0

Hello,

 

I'm working through the build a Shopify app with node and react tutorial and when I try to save my product's new price I get an error: GraphQL error: ProductVariantUpdate access denied.  I've got the scopes 'read_product' and 'write_product' in the app code.  Just can't quite figure out what I'm missing.  Any help is greatly appreciated.

 

Thanks,

 

Justin

0 Likes
SBD_
Shopify Staff
Shopify Staff
1089 147 199

Hey @jbk 

 

Can you share the query and a request ID from the response headers?

0 Likes
jbk
New Member
4 0 0

Interestingly enough, it seems to be working now.  No idea why it wasn't working before, nothing has changed in the app since I last tried to save. ¯\_(ツ)_/¯

0 Likes
ariaz
New Member
1 0 0

Hi there,

 

I am having same issue, but unfortunately not correcting itself thus far..

Here are the query and request id from headers.

query"mutation productVariantUpdate($input: ProductVariantInput!) {↵ productVariantUpdate(input: $input) {↵ product {↵ title↵ __typename↵ }↵ productVariant {↵ id↵ price↵ __typename↵ }↵ __typename↵ }↵}↵"

 

cf-request-id: 02d5e37fa50000b8ff9c052200000001

x-request-id: adce43d3-a81f-4e84-809b-e7871831e358

 

I have tried this from the Shopify GraphQL App and it works:

 

mutation productVariantUpdate($input: ProductVariantInput!) {
productVariantUpdate(input: $input) {
product {
title
}
productVariant {
id
price
}
}
}

 

{
"input": {"id": "gid://shopify/ProductVariant/32416951926889", "price": "5.20"}
}

 

Thanks for the help!

 

0 Likes
SBD_
Shopify Staff
Shopify Staff
1089 147 199

@ariaz our logs report: ScopeNotApprovedByMerchant. Have they approved write_products scope?

0 Likes
wilk
New Member
1 0 4

It happened to me as well while following the tutorial. My solution was to log out and log back into the dev shop, so that the app would authenticate again. Hope it helps.

Nobel_Reo
New Member
2 0 0

I tried. Not working......

0 Likes
l3e0wu1f
Excursionist
10 0 5

@Nobel_Reo wrote:

I tried. Not working......


There's a typo in the tutorial (https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/).

On Page 6 (Fetch data with Apollo), Step 5 says to add this line to server.js: server.use(graphQLProxy({version: ApiVersion.October19})) but it is missing the semi-colon.

Fix:

  1. Add ; to the end of the line in your server.js file. The new line should say:
    server.use(graphQLProxy({version: ApiVersion.October19}));
  2. In your command line, CTRL+C in the ngrok window to close the server connection. Do the same in your local Node server window.
  3. Relaunch ngrok, relaunch node server, and plug your new ngrok URL into the App Settings screen from Partner Dashboard.
  4. Lastly, reload your browser tab with your app's index screen open.

This is what I did to fix the issue.

robin_sandhu
Tourist
8 0 0

thanks brother

0 Likes
robin_sandhu
Tourist
8 0 0

i already placed semi-colon but logging out of the store helped me

0 Likes