Wp-graphql-woocommerce: Cart mutations timeout in certain environments

Created on 27 Mar 2020  ·  8Comments  ·  Source: wp-graphql/wp-graphql-woocommerce

Describe the bug

A clear and concise description of what the bug is.

Sorry if this one is a big vague but I'm not proficient in WordPress or PHP but I was able to create somewhat of a reproduction.

The bug (maybe?) is that in certain environments, cart mutations will timeout and result in some 5xx error. Locally (in a docker container) it seems to be fine.

Maybe it's an HTTPS issue? I honestly don't know much here 😅

To Reproduce

Steps to reproduce the behavior:

I created an EasyWP test site to try this out in. This instance contains a brand new installation of WPGraphQL, WooGraphQL, and WooCommerce. Feel free to use it to test this out.

  1. add an item to the cart using the addToCartMutation
mutation {
  addToCart(input: {clientMutationId: "some-id", productId: 8}) {
    cart {
      contents {
        nodes {
          key
          product {
            name
          }
        }
      }
    }
  }
}
  1. Make a query for the cart but include the woocommerce-session header from the pervious request.

the query:

{
  cart {
    subtotal
    contents {
      nodes {
        product {
          name
        }
      }
    }
  }
}

the full curl:

curl --request POST \
  --url https://test-13406f.ingress-bonde.easywp.com/graphql \
  --header 'content-type: application/json' \
  --header 'woocommerce-session: Session eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdGVzdC0xMzQwNmYuaW5ncmVzcy1ib25kZS5lYXN5d3AuY29tIiwiaWF0IjoxNTg1Mjc3MzI0LCJuYmYiOjE1ODUyNzczMjQsImV4cCI6MTU4NTQ1MDEyNCwiZGF0YSI6eyJjdXN0b21lcl9pZCI6IjA4NjUxZjQ0NzU4MGY0NjU0MTY5NDdhN2U5MTI2Zjk4In19.lEL0WsgU5Ah9BSkj1Uonv9DDKWvo_FCnWFcX2HMn_9w' \
  --data '{"query":"{\n  cart {\n    subtotal\n    contents {\n      nodes {\n        product {\n          name\n        }\n      }\n    }\n  }\n}"}'
  1. Notice the timeout after ~60 seconds.

Expected behavior

A clear and concise description of what you expected to happen.

It should return the correct cart from the session

Screenshots

If applicable, add screenshots to help explain your problem.

image

Additional context

Add any other context about the problem here.

  • WordPress 5.3.2
  • WooCommerce 4.0.1
  • WPGraphQL 0.7.1
  • WooGraphQL 0.4.2

@kidunot89 If it's helpful, I can give you access to this WordPress instance. DM me on slack @Rico Kahler

bug

Most helpful comment

@ricokahler @pandabrand @mujz This is likely to be resolved with this PR #398

All 8 comments

Update: I updated the test instance to WPGraphQL 0.8.0 and WooGraphQL 0.5.0 and this issue still occurs. Also this happens in both managed WP providers: WPEngine and EasyWP

@ricokahler I haven't had time to look into this yet. Do you possibly have access to the Apache or Nginx error logs for either of those servers?

Do you possibly have access to the Apache or Nginx error logs for either of those servers?

Not that I'm aware of. EasyWP gives you SFTP access and Database access but nothing for Apache/Nginx logs.

I could probably get some logs the from WPEngine instance however that's my workplace's environment so it's a bit harder to give you those.


An interesting thing I found out about it is that if I retry a request with a session a few hours later, it works and doesn't timeout. But if I re-request that same request a few seconds later, it times out. I don't know if that makes things easier or harder to debug 🤷‍♀️

Thanks for looking into this. Feel free to DM me on slack.

I'm getting this too and not sure how to fix it. It's blocking us in production currently. Is there any quick fix or workaround I can try? :sob:
Thank you!

Any update on this @mujz

@mujz I'll try and look more into this soon. Sounds like something maybe going astray with the session token.

@mujz Did you ever get a solution on this? I'm currently having the same isuue.

@ricokahler @pandabrand @mujz This is likely to be resolved with this PR #398

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jake-101 picture jake-101  ·  7Comments

huniqcast picture huniqcast  ·  4Comments

craigwilcox picture craigwilcox  ·  4Comments

hwsiew picture hwsiew  ·  6Comments

paplco picture paplco  ·  4Comments