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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_objects fails when passing in attributesToRetrieve #469

Open
PFStein opened this issue Jan 11, 2022 · 1 comment · May be fixed by #499
Open

get_objects fails when passing in attributesToRetrieve #469

PFStein opened this issue Jan 11, 2022 · 1 comment · May be fixed by #499

Comments

@PFStein
Copy link

PFStein commented Jan 11, 2022

  • Algolia Client Version: algolia (2.2.2)
  • Language Version: ruby 2.6.5p114 (2019-10-01 revision 67812) [-darwin21]

Description

When passing in attributesToRetrieve to get_objects we receive an http error stating that attributesToRetrieve is an invalid key. We traced the issue back to the call made to the Algolia API here:

@transporter.read(:POST, '/1/indexes/*/objects', { 'requests': requests }, opts)

We tested that if we pass in request_options instead opts the call works as documented.

Steps To Reproduce

search_config = Algolia::Search::Config.new(
  application_id: 'app_id', api_key: 'api_key', symbolize_keys: false,
)
client = Algolia::Search::Client.new(search_config, { logger: Rails.logger })
index = client.init_index('my_index')
index.get_objects(['1'], { attributesToRetrieve: ["id"] })
# Fails with invalid key 'attributesToRetrieve'. Expected: appID, apiKey, requests (near 1:121)
@liamgriffiths
Copy link

Additionally, it would be nice to use opts.dup on the parameter to avoid mutating a potentially frozen options hash.

@PFStein PFStein changed the title get_objects fails when passing in attributesToRecieve get_objects fails when passing in attributesToRetrieve Jan 11, 2022
@camel2243 camel2243 linked a pull request Jul 10, 2024 that will close this issue
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