I’m building a Node.js app for Shopify billing subscriptions but keep running into a DNS resolution error. When I try to call my subscription creation function, I get this error:
FetchError: request to https://[ACCESS_TOKEN]/admin/api/2020-10/graphql.json failed, reason: getaddrinfo ENOTFOUND [ACCESS_TOKEN]
yeah, i think u might be using the access token as hostname. double check ur storeName variable - it could be grabbing the token instead. adding some console.logs could help to see what values ur passing.
You’ve got variables mixed up somewhere. The error shows [ACCESS_TOKEN] in the URL instead of your actual store name.
Check your URL construction - you’re using https://${storeName} but it needs to be https://${storeName}.myshopify.com. That missing .myshopify.com is why DNS can’t find it.
Also double-check where you’re calling this function. You might be accidentally passing the access token as the storeName parameter.
Debugging Shopify API calls gets messy fast. Been there with the same headaches.
I handle all my Shopify billing through automation now. Set up GraphQL calls, error handling, and subscription management in a visual workflow. No more DNS issues or parameter mix-ups.
You can see exactly what data flows where, plus you get built-in error handling and logging.
Your URL is broken - the DNS resolver is looking for a host called [ACCESS_TOKEN] which doesn’t exist. You’ve got a variable substitution problem somewhere in your code.
Had the same issue last year with subscription management. Turned out I’d swapped parameters when calling the function, so the access token was getting passed as the store name.
Besides the obvious .myshopify.com domain fix others mentioned, validate your parameters before hitting the API. Quick checks to make sure storeName is actually a string with the right value. Environment variables or async operations can let undefined values sneak through.
Also, you’re on 2020-10 API version - that’s pretty old. Might want to upgrade to avoid deprecation headaches later.
u might be passing the wrong params in the function call. that error is saying DNS sees ur access token as the hostname. make sure you’re not mixing up the token and stroeName args when u call createBillingSubscription.
That ENOTFOUND error suggests there’s an issue with your URL construction. You need to ensure you’re including the full domain in the fetch URL. Modify it to https://${storeName}.myshopify.com/admin/api/2020-10/graphql.json instead of just https://${storeName}/admin/api/2020-10/graphql.json. The absence of .myshopify.com means DNS can’t resolve it. I’ve faced a similar issue while setting up subscription billing previously. Additionally, verify that your storeName is purely the shop name without any extra formatting or unnecessary characters.