shopify-api-js icon indicating copy to clipboard operation
shopify-api-js copied to clipboard

REST client GET request logs "API Deprecation Notice" warning

Open NathanScheele opened this issue 2 years ago • 2 comments

Issue summary

I have a custom Shopify app, which makes calls to various REST API endpoints. Regardless of which API version I use, an API Deprecation Notice is logged to the console.

Expected behavior

According to Shopify's versioning documentation,

If individual properties on a resource are deprecated, then GET requests to that resource don't return the deprecation header in the response.

I would expect no warning to be logged when sending a GET request to the orders endpoint.

Actual behavior

The following warning is logged in the console:

API Deprecation Notice: {
  message: 'https://shopify.dev/changelog/property-deprecations-in-the-rest-admin-api-order-resource',
  path: 'https://my-shopify-store.myshopify.com/admin/api/unstable/orders/123456789.json?fields=id%2Cname%2Ctags%2Cline_items%2Cshipping_address%2Cshipping_lines%2Ccreated_at%2Cemail%2Ccancelled_at'
}

Steps to reproduce the problem

const {Shopify} = require("@shopify/shopify-api");

const shopifyRestClient = new Shopify.Clients.Rest("my-shopify-store.myshopify.com", "shpat_xxx");

shopifyRestClient.get({ path: 'orders/123456789' });

Checklist

  • [x] I have described this issue in a way that is actionable (if possible)

NathanScheele avatar Mar 03 '22 20:03 NathanScheele

Hey @NathanScheele

i also get this warning with my "orders" api call.

API Deprecation Notice: {
  message: 'https://shopify.dev/changelog/property-deprecations-in-the-rest-admin-api-order-resource',
  path: 'https://my-shopify-store.myshopify.com/admin/api/2022-01/orders.json?updated_at_min=2022-03-04T10%3A15%3A00&status=closed'
}

i do understand the notice on the page of the link provided

https://shopify.dev/changelog/property-deprecations-in-the-rest-admin-api-order-resource

it is clear which resources are deprecations. However, none of them directly affect the execution of my api call.

I think this "Notice" can be neglected as long as you do not address one of these resources directly with your api call.

- last_order_id
- last_order_name
- orders_count
- total_spent

BR Timo

fotimo avatar Mar 04 '22 12:03 fotimo

Is there any way to hide it now? I am filling the logs of that warning.

EduardoMateos avatar Apr 22 '22 10:04 EduardoMateos

This issue is stale because it has been open for 90 days with no activity. It will be closed if no further action occurs in 14 days.

github-actions[bot] avatar Oct 06 '22 02:10 github-actions[bot]

We are closing this issue because it has been inactive for a few months. This probably means that it is not reproducible or it has been fixed in a newer version. If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.

If you still encounter this issue with the latest stable version, please reopen using the issue template. You can also contribute directly by submitting a pull request– see the CONTRIBUTING.md file for guidelines

Thank you!

github-actions[bot] avatar Oct 20 '22 02:10 github-actions[bot]

This is still happening to me. Is there a way to suppress the warning message?

mbernardes19 avatar Dec 08 '22 13:12 mbernardes19

Still happening, it's a bit annoying with version 6.1.0 to see that in the response as it also generates a "Stack Trace: Error". I'm using Serverless by the way.

bernier avatar Jan 24 '23 23:01 bernier

sir how am i relist my shopify app, due to access token missing when shopify emailed me now i update all OAuth scopes but still my app delisted.

Zain-dev1 avatar Feb 07 '23 13:02 Zain-dev1

still happening, when all I return are the shipping_lines

Trimakas avatar Mar 04 '23 21:03 Trimakas

I also, get this warning when trying to create an order with REST Admin API

ab-etemadi avatar Mar 14 '23 06:03 ab-etemadi

Is there a way to disable it for production?

StefanoDiLegami avatar Mar 30 '23 12:03 StefanoDiLegami

The API deprecation notice works this way:

const deprecationReason = getHeader(
      response.headers,
      'X-Shopify-API-Deprecated-Reason',
    );
    if (deprecationReason) {
        const stack = new Error().stack;
        const message = `API Deprecation Notice ${new Date().toLocaleString()} : 

If the program picks up a 'X-Shopify-API-Deprecated-Reason' header in the REST response, it will log a warning to the console accordingly. I come to realize that the information in this header is not always accurate...

I simply comment out the following line in this file of the module: lib/clients/http_client/http_client.js yield log.warning(message)

then patch the package: https://www.npmjs.com/package/patch-package

and enjoy peace

yanisforcedtocode avatar May 06 '23 12:05 yanisforcedtocode

I also get a warning when I apply for Ordes

indice avatar Jun 08 '23 11:06 indice

It would be really nice to have a setting exposed that allows for suppressing things in production. Our logs are filled with these while retrieving orders for fields we are not using.

jsullivan5 avatar Jul 07 '23 01:07 jsullivan5

FWIW, can shush this in setting up shopifyApi:

shopifyApi({
    apiKey: ....
    apiSecretKey: ....
    scopes: ...
    hostName: ....
    logger: {
        level: 0  //stop the deprecation warnings by setting to Error level (0)
    }
});

Can't speak to what else might be silenced as a result.

brianhenryhf avatar Aug 01 '23 20:08 brianhenryhf