Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

index.getObject() does not work with full Shopify ID #797

Closed
julio-tc opened this issue Aug 10, 2022 · 0 comments 路 Fixed by #798
Closed

index.getObject() does not work with full Shopify ID #797

julio-tc opened this issue Aug 10, 2022 · 0 comments 路 Fixed by #798
Assignees

Comments

@julio-tc
Copy link

Describe the bug 馃悰
Passing a full Shopify ID to index.getObject() does not work on latest v.8.15.0.
Example full Shopify ID gid://shopify/Collection/409017809

Our swift project is currently using v7.0.0 and it does work there, we are trying to update to the latest version but getObject() fails

v7.0.0 - working:

index.getObject(withID: "gid://shopify/Collection/409017809", attributesToRetrieve: []) { }

produces URL request:

https://22mg8hzkho-dsn.algolia.net/1/indexes/shopify_production_collections/gid:%2F%2Fshopify%2FCollection%2F409017809

produces response:

{
  <various searchable attributes>,
  "objectID": "gid://shopify/Collection/409017809"
}

v8.15.0 - fails:

index.getObject(withID: ObjectID(rawValue: "gid://shopify/Collection/409017809"), attributesToRetrieve: []) { }

produces URL request:

https://22mg8hzkho-dsn.algolia.net/1/indexes/shopify_production_collections/gid://shopify/Collection/409017809

produces response:

{
  "message": "Path not supported by Algolia REST API. Please have a look at https://www.algolia.com/doc/rest-api/search/ for the list of valid commands",
  "status": 404
}

v8.15.0 - fails with pre-encoded ID:

let encodedID = "gid://shopify/Collection/409017809".addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
index.getObject(withID: ObjectID(rawValue: encodedID), attributesToRetrieve: []) { }

produces URL request:

https://22mg8hzkho-dsn.algolia.net/1/indexes/shopify_production_collections/gid%253A%252F%252Fshopify%252FCollection%252F409017809

produces response:

{
  "message": "ObjectID does not exist",
  "status": 404
}

Secondary Bug 馃悰
Adding attributesToRetrieve to same index.getObject() function in v8.15.0 also does not work.
This is because in line 86 of RequestOptions.swift the static var has a misspelling attributesToRetreive and should be attributesToRetrieve

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

Successfully merging a pull request may close this issue.

2 participants