Closed ration closed 3 years ago
The documentation does not mention custom domains. Can't you use the yourshop.myshopify.com
domain?
The yourshop.myshopify.com
domain is echoed back in the checkout url in the checkout calls and we do not want this to be exposed to customers (or manually tamper with he returned url if we don't want to).
Yes the documentation about this is rather lacking. It's kinda mentioned [domain documentation]( ) and in this discussion
Are you sure your custom domain will be used in the API response if you make the request using the custom domain? Did you already test this?
Not with Shopify-api-node. There was a similar issue in js-buy-sdk and in there it works.
Can you please try with curl
, https://insomnia.rest/ or any other HTTP client? The buy sdk is a different thing.
Do you have some specific endpoint in mind?
curl https://user@pass:example.com/admin/api/2020-10/orders/count.json
=> {"count":123}
Now that I test this more it feels like a mess. Some endpoints work fine and some will give you a "permanent redirect" to the myshopify address. I tried to modify the index.js and allow the custom url and it crashes to this redirect failure.
Maybe I'll just give up and split the the code into parts that that use shopify-buy
and parts that use shopify-api-node
and point them to different addresses.
I don't know what exactly you mean by js-buy-sdk
being a different thing (it uses the same APIs?), but through it it will give back the custom domain:
Client.buildClient(
{ domain: "exmaple.com", TOKEN},
fetch
).checkout.create({
lineItems: []
}).then(a => {
console.log(a.webUrl);
});
--> https://example.com/32522974935/checkouts/2908gfkfgjfdlk?key=flkfjdslfk
I don't know what exactly you mean by
js-buy-sdk
being a different thing (it uses the same APIs?)
The js-buy-sdk
uses the STOREFRONT API, this client is for the REST admin API. The two API are different.
Yes thanks I'm aware of this. But as I stated above, some admin endpoints work and some, it looks like, do not. So I think this support is premature.
Thanks anyway.
Hello, If you setup a custom domain for the shop, and use the client through it, it won't work. If you for example configure
example.com
as your Shopify site, using the client to connect to this instance will result in the client attempting to connect toexample.com.myshopify.com
and fail.'index.js:57:
Attempting to use the custom domain thus fails in a somewhat confusing error:
Hostname/IP does not match certificate's altnames: Host: example.com.myshopify.com. is not in the cert's altnames: DNS:myshopify.com, DNS:*.myshopify.com
Seems like a trivial thing to fix/support though, but I'm unsure how to fix it. Add another parameter
customDomain
or something?