Receiving 404 on Rest Client Get Request

Paul-CF
Visitor
3 0 0
I'm using the shopify-api npm library to try and make a get request for the customers object on the Rest API using the following:    
 
const client = new Shopify.Clients.Rest('cf-app-test.myshopify.com', accessToken);
const data = await client.get({
  path: 'customers',
});
 
However when this section runs I get the following error in the console:
 
Error: Received an error response (404 Not Found) from Shopify: Not Found. If you report this error, please include this id: ec3e6846-2190-4436-b0f1-8f9574a98bdb
 
Any help appreciated!
Replies 4 (4)

Luke_K
Shopify Staff
402 66 98

Hey @Paul-CF 

Thanks for raising this!  From the request ID, I can see that that GET request to Customers endpoint is"/admin/api/undefined/customers.json" which is unknown and throws a 404.

I would say if you're targeting a specific API version and it's still not working after that,  the best bet would be to raise this within the Shopify-API Npm Repo directly here - the Developers of the package would see the post in that repo and be able to help troubleshoot. Hope that helps!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
Paul-CF
Visitor
3 0 0

Thanks for your reply.

 

I can't seem to find a way to define that other than in the context when initialising, where I set it to ApiVersion.October21:

 

Shopify.Context.initialize({
  API_KEY: process.env.SHOPIFY_API_KEY,
  API_SECRET_KEY: process.env.SHOPIFY_API_SECRET,
  SCOPES: process.env.SCOPES.split(","),
  HOST_NAME: process.env.HOST.replace(/https:\/\//, ""),
  API_VERSION: ApiVersion.October21,
  IS_EMBEDDED_APP: true,
  SESSION_STORAGE: new Shopify.Session.MemorySessionStorage(),
});
 
Should I be defining this when making the get request too?
Luke_K
Shopify Staff
402 66 98

Hey @Paul-CF 

It seems that you've followed the docs correctly to perform a GET as per the Shopify API Node docs here. Seems to me the context has been defined ok too.

October21 version is available to the library in version 2.0.0 of the Shopify API Node library.

I noted in the logs on that request id that the library version you're using is v1.2.1 - we added 2021-10 to the library 19 days ago - your version possibly might not have this change.

I'd try updating to the latest version, and see how you go. If still experiencing issue after that, Uunless another member of the Shopify Community chimes in on this thread, I'd encourage you to raise an issue in the Github repo. Hope that helps!

 

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
Paul-CF
Visitor
3 0 0

Thanks for the response, I've reinstalled the shopify-api-node npm package (now npm list shopify-api-node now shows shopify-api-node@3.8.0) and tried this again, it seems now that I am getting a 404 still however the id appears to be different, are you able to advise any further on this?

 

Error: Received an error response (404 Not Found) from Shopify: Not Found. If you report this error, please include this id: 49fcbbf8-db0a-47e6-8eac-0b9890fa6d53