Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

REST client GET request logs "API Deprecation Notice" warning #315

Closed
1 task done
NathanScheele opened this issue Mar 3, 2022 · 14 comments
Closed
1 task done

REST client GET request logs "API Deprecation Notice" warning #315

NathanScheele opened this issue Mar 3, 2022 · 14 comments
Labels

Comments

@NathanScheele
Copy link

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

  • I have described this issue in a way that is actionable (if possible)
@fotimo
Copy link

fotimo commented Mar 4, 2022

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

@EduardoMateos
Copy link

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2022

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 github-actions bot added the Stale label Oct 6, 2022
@github-actions
Copy link
Contributor

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!

@mbernardes19
Copy link

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

@bernier
Copy link

bernier commented Jan 24, 2023

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.

@Zain-dev1
Copy link

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.

@Trimakas
Copy link

Trimakas commented Mar 4, 2023

still happening, when all I return are the shipping_lines

@ab-etemadi
Copy link

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

@StefanoDiLegami
Copy link

Is there a way to disable it for production?

@yanisforcedtocode
Copy link

yanisforcedtocode commented May 6, 2023

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

@indice
Copy link

indice commented Jun 8, 2023

I also get a warning when I apply for Ordes

@jsullivan5
Copy link

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.

@brianhenryhf
Copy link

brianhenryhf commented Aug 1, 2023

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests