A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I create last year an external application that connects to shopify per API in order to read, create, edit and delete products. I am using PHP and CURL by calling for example
https://myshop.myshopify.com/admin/api/2024-01/products/12345.json
The header includes the X-Shopify-Access-Token.
When I am using the application or even Postman locally on my development server, it still works fine.
Using it from the production server, it does not work anymore and I get a time out.
Neither Server config did change nor the application code nor PHP. Firewall is ok and did not change either.
I might has happened when shop has received an own domain, so I was thinking a reroute is happening. But calling the API with the new domain does not work either; only locally.
The CURL parameters are the following.
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$headers = [
'X-Shopify-Access-Token:'.$token,
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Content-Type: application/json'
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
Any idea what could have happened ?
Is my server IP black listed at shopify ?
Thanks for any idea
Hi TorstenBreuer,
This does sound pretty unusual - but there's a couple things you could try:
DNS Resolution Issues: Since you mentioned the shop receiving its own domain, there might be DNS resolution issues at play. Ensure that your production server can resolve the shop's new domain name. You can test this using nslookup
or ping
commands.
Server Environment Differences: Even though you mentioned that neither server configuration nor PHP changed, it's worth revisiting this. Sometimes, subtle differences in PHP versions, curl versions, or server configurations (like security modules or outbound request restrictions) can lead to such issues.
SSL/TLS Issues: Since you're using CURLOPT_SSL_VERIFYPEER
set to false, it's less likely, but there might still be SSL/TLS related issues. It's advisable to set CURLOPT_SSL_VERIFYPEER
to true for security reasons and then see if there's an issue with SSL certificate verification.
Network Configuration or Firewall: Recheck the production server's network configuration and firewall settings. Sometimes, changes in network policies or updates in firewall rules can restrict outbound HTTP requests.
Rate Limiting or API Throttling: Shopify has rate limits for API requests. If your production server is making too many requests in a short time, Shopify might throttle these requests, resulting in timeouts.
Try out the above and see if your issue is resolved.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog