Closed ghulamali16 closed 3 months ago
I am getting this too
I am getting this too
@mattsrobot were you able to resolve this? or maybe find a workaround for this?
I'm also still seeing this, and it's just coming from a pretty simple call to:
response = ShopifyAPI::Order.all(
session: session,
financial_status: 'paid,partially_paid,partially_refunded',
updated_at_min: after,
status: fetch_status,
test: ENV['ENVIRONMENT'] === 'development',
)
Presumably Order.all
is doing some stuff internally that is going to be deprecated but it would be nice to know that Shopify has this in-hand and this isn't just going to break at some point!
Does anybody found a solution?
Anyway it doesn't seems to be related to the gem. I made a simple test using Faraday and I got the same issue.
def api_rest_url
"https://#{shop.shopify_domain}/admin/api/#{shop.api_version}" # using 2023/10 at the moment
end
def shopify_get(session, resource, id = nil, params = {})
conn = Faraday.new(
url: api_rest_url,
headers: {
'Content-Type' => 'application/json',
'X-Shopify-Access-Token' => session.access_token
}
)
response = conn.get("#{resource}/#{id}.json?fields=id,name")
end
Output:
`
@env=
#<struct Faraday::Env
method=:get,
request_body=nil,
url=#<URI::HTTPS https://corrispettivi-dev-store.myshopify.com/admin/api/2023-10/orders/5296173809801.json?fields=id%2Cname>,
request=#<struct Faraday::RequestOptions params_encoder=nil, proxy=nil, bind=nil, timeout=nil, open_timeout=nil, read_timeout=nil, write_timeout=nil, boundary=nil, oauth=nil, context=nil, on_data=nil>,
request_headers={"Content-Type"=>"application/json", "X-Shopify-Access-Token"=>"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", "User-Agent"=>"Faraday v2.7.11"},
ssl=
#<struct Faraday::SSLOptions
verify=true,
verify_hostname=nil,
ca_file=nil,
ca_path=nil,
verify_mode=nil,
cert_store=nil,
client_cert=nil,
client_key=nil,
certificate=nil,
private_key=nil,
verify_depth=nil,
version=nil,
min_version=nil,
max_version=nil>,
parallel_manager=nil,
params=nil,
response=#<Faraday::Response:0x00000001111bc288 ...>,
response_headers=
{"date"=>"Wed, 01 Nov 2023 10:58:17 GMT",
"content-type"=>"application/json; charset=utf-8",
"transfer-encoding"=>"chunked",
"connection"=>"keep-alive",
"x-sorting-hat-podid"=>"136",
"x-sorting-hat-shopid"=>"55695999113",
"vary"=>"Accept-Encoding",
"referrer-policy"=>"origin-when-cross-origin",
"x-frame-options"=>"DENY",
"x-shopid"=>"55695999113",
"x-shardid"=>"136",
"x-stats-userid"=>"",
"x-stats-apiclientid"=>"6389815",
"x-stats-apipermissionid"=>"383167398025",
"x-shopify-api-version"=>"2023-10",
"http_x_shopify_shop_api_call_limit"=>"1/40",
"x-shopify-shop-api-call-limit"=>"1/40",
"x-shopify-api-deprecated-reason"=>"https://shopify.dev/changelog/property-deprecations-in-the-admin-api-order-and-lineitem-resource",
"strict-transport-security"=>"max-age=7889238",
"server-timing"=>"processing;dur=89, cfRequestDuration;dur=230.000019",
"x-shopify-stage"=>"production",
"content-security-policy"=>
"default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net https://checkout.shopifycs.com https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=show&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Forders&source%5Bsection%5D=admin_api&source%5Buuid%5D=a86ae15c-12b0-4978-9f4a-016c8f8f99dd",
"x-content-type-options"=>"nosniff",
"x-download-options"=>"noopen",
"x-permitted-cross-domain-policies"=>"none",
"x-xss-protection"=>
"1; mode=block; report=/xss-report?source%5Baction%5D=show&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Forders&source%5Bsection%5D=admin_api&source%5Buuid%5D=a86ae15c-12b0-4978-9f4a-016c8f8f99dd",
"x-dc"=>"gcp-europe-west8,gcp-us-east1,gcp-us-east1",
"content-encoding"=>"gzip",
"x-request-id"=>"a86ae15c-12b0-4978-9f4a-016c8f8f99dd",
"cf-cache-status"=>"DYNAMIC",
"report-to"=>
"{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=f4v4w54RvljMj99wfYeCcF7pELu1g97CehnjMWOTCr7YVVsCbhAFMp7kbrjRIXMyluqf8w3wHuRs5UNY8s1z8NBkkT9rs8y3XgJp1jD2Hh9zotCfENsY%2Fryq3lSv%2BgNrEABPniQ8JQTWWwQO2nkXSAnFOjxlb0I%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}",
"nel"=>"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}",
"server"=>"cloudflare",
"cf-ray"=>"81f39f2c7852bad9-MXP",
"alt-svc"=>"h3=\":443\"; ma=86400"},
status=200,
reason_phrase="OK",
response_body="{\"order\":{\"id\":5296173809801,\"name\":\"#1044\"}}">,
@on_complete_callbacks=[]>
`
As you can see I received only id
and name
fields
response_body="{\"order\":{\"id\":5296173809801,\"name\":\"#1044\"}}"
But it keeps complaining that I am using deprecated API calls:
"x-shopify-shop-api-call-limit"=>"1/40", "x-shopify-api-deprecated-reason"=>"https://shopify.dev/changelog/property-deprecations-in-the-admin-api-order-and-lineitem-resource",
Getting the same issue just FYI & it's March 2024, doesnt seem to have been addressed...
I am going to close this issue.
As @link82 pointed out this is not related to the gem specifically. If you make an API call to a REST resource with deprecated fields, it will return to you a warning about the deprecated fields. This gem then forwards that error message.
If you are not using those fields then you can ignore the message.
Personally I don't think that's a satisfactory result - on a sufficiently-sized codebase it results in way too many false-negatives. It would be far better to throw these deprecation errors from attribute getters, rather than just an API call that included them. It essentially makes deprecation errors absolutely useless - can we ignore them? Can't we? Who knows!
Hey @jaspertandy
I think that is very fair feedback.
I have brought this up with the API team, to resolve this at the API level, the API shouldn't return warnings if you are not affected but at this time I have no updates to pass along.
We don't really have a good way to solve this at the gem level at this time. As a we don't know what fields are deprecated. We would need to get that information into the library first. I will reflag with the product team about getting that information into the library, as this is something we have discussed in the past.
Completely understand @lizkenyon - I wasn't expecting an immediate solution and I know it's not a simple problem (otherwise Shopify probably would have done it long ago!). I also appreciate that it's not a very glamourous problem to work on, but I do appreciate you and the team reconsidering it.
On another service it wouldn't be such a problem but Shopify's API moves very quickly and we need to be able to trust and react to those deprecations so we don't get stung by them!
Issue summary
shopify_api
version: 2022-10Expected behavior
No Deprecation warnings upon requesting order resources
Actual behavior
https://shopify.dev/changelog/property-deprecations-in-the-admin-api-order-and-lineitem-resource But when I go to https://shopify.dev/changelog/property-deprecations-in-the-admin-api-order-and-lineitem-resource I'm not using any of the attributes here.
I'm guessing/hoping this is to do with the API wrapper itself requesting these fields when it sets data from the API, and triggering its own deprecations but it would be good to get confirmation of that as it's super confusing.