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

[bug]: personalizationClient.setPersonalizationStrategy always returns ApiError 422 #1577

Closed
dannymarsland opened this issue Jan 2, 2025 · 0 comments · Fixed by algolia/api-clients-automation#4298
Labels

Comments

@dannymarsland
Copy link

Description

API docs: https://www.algolia.com/doc/libraries/javascript/v5/methods/personalization/set-personalization-strategy/?client=javascript

The following request will fail:

const response = await personalizationClient.setPersonalizationStrategy({
        eventScoring: [{ score: 42, eventName: 'Algolia', eventType: 'click' }],
        facetScoring: [{ score: 42, facetName: 'Event' }],
        personalizationImpact: 42,
});

The personalizationClient expects the properties eventScoring and facetScoring whereas the underlying API expects the pluralised eventsScoring and facetsScoring.

The API docs also incorrectly use the non plural property names https://www.algolia.com/doc/rest-api/personalization/#tag/strategies

Client

Personalization

Version

5.18.0

Relevant log output

ApiError: Unknown field "eventScoring"
    at deserializeFailure (node_modules/@algolia/client-common/src/transporter/helpers.ts:91:12)
    at retry (node_modules/@algolia/client-common/src/transporter/createTransporter.ts:194:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async run (src/scripts/configure-algolia-personalisation.ts:64:22) {
  stackTrace: [
    {
      request: [Object],
      response: [Object],
      host: [Object],
      triesLeft: 0
    }
  ],
  status: 422
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant