[go: nahoru, domu]

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

Invalid integer type for parsing BatchRes #591

Closed
ViBiOh opened this issue Mar 23, 2020 · 1 comment · Fixed by #599
Closed

Invalid integer type for parsing BatchRes #591

ViBiOh opened this issue Mar 23, 2020 · 1 comment · Fixed by #599

Comments

@ViBiOh
Copy link
ViBiOh commented Mar 23, 2020
  • Algolia Client Version: 3.6.0
  • Language Version: golang

Description

I've got an error while deleting index, running client on a 32 bits ARM architecture (Raspberry Pi4 with Raspbian, so not 64 bits.).

The number returned by API seems to be an int64, but defined as an int.

It works on 64 bits architecture, as int is an int64 on this kind of machine.

cannot deserialize response's body: json: cannot unmarshal number 116817924001 into Go struct field DeleteTaskRes.taskID of type int

Steps To Reproduce

Simple case:
https://play.golang.org/p/TXNc0T-PUoz

Change int to int64, and it works.

Real case (on a 32bits architecture):

client := search.NewClient(app, key)
index := client.InitIndex(indexName)

if _, err := index.Delete(); err != nil {
	log.Fatal(err)
}
aseure added a commit that referenced this issue Apr 23, 2020
…erywhere

We've recently noticed that all integers representing task IDs coming
from Algolia were wrongly typed as 32b integers. However, the Algolia
engine is returning JSON numbers which can go beyond the range of 32b: a
JSON number can be as big as 2^53.

For this reason, this commit is changing the type of all the taskID
variables as well as all function accepting task IDs from `int` to `int64`.

This change was automated, for the most part, with the two following sed
commands:

```
find . -name '*.go' -exec gsed -Ei 's/taskID( +)int\)/taskID\1int64\)/' {} \;
find . -name '*.go' -exec gsed -Ei 's/TaskID( +)int/TaskID\1int64/' {} \;
```

Fix #591
@aseure
Copy link
Contributor
aseure commented Apr 23, 2020

Thanks for reporting this. Task IDs are indeed representable up to 2^53 (maximum integer of JSON numbers) and hence should be handled via 64b integers. PR #599 is fixing this!

aseure added a commit that referenced this issue Apr 24, 2020
…erywhere

We've recently noticed that all integers representing task IDs coming
from Algolia were wrongly typed as 32b integers. However, the Algolia
engine is returning JSON numbers which can go beyond the range of 32b: a
JSON number can be as big as 2^53.

For this reason, this commit is changing the type of all the taskID
variables as well as all function accepting task IDs from `int` to `int64`.

This change was automated, for the most part, with the two following sed
commands:

```
find . -name '*.go' -exec gsed -Ei 's/taskID( +)int\)/taskID\1int64\)/' {} \;
find . -name '*.go' -exec gsed -Ei 's/TaskID( +)int/TaskID\1int64/' {} \;
```

Fix #591
mehmetaligok pushed a commit that referenced this issue May 3, 2023
* Automatic empty commit

* chore(deps): update dependency @prettier/plugin-php to v0.18.6 (#581)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency @redocly/openapi-cli to v1.0.0-beta.94 (#582)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency com.squareup.okhttp3:logging-interceptor to v4.9.3 (#583)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency com.squareup.okhttp3:okhttp to v4.9.3 (#584)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency dotenv to v16.0.1 (#585)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency io.github.cdimascio:dotenv-java to v2.2.3 (#587)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency inquirer to v8.2.4 (#586)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency prettier-plugin-java to v1.6.2 (#588)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency semver to v7.3.7 (#589)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency ts-jest to v27.1.5 (#600)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update babel monorepo (#603)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency @apidevtools/swagger-parser to v10.1.0 (#604)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency @rollup/plugin-node-resolve to v13.3.0 (#605)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency @types/jest to v27.5.1 (#606)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency commander to v9.3.0 (#608)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency husky to v8 (#593)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update jest monorepo to v28 (#597)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency openapi-types to v11 (#595)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency eslint-plugin-yml to v1 (#591)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* fix yaml parser

* upgrade yarn

* remove packageManager in js client

* chore(deps): update dependency eslint to v8.16.0 (#609)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* fix(deps): update dependency prism-react-renderer to v1.3.3 (#601)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency lerna to v5 (#594)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency com.google.code.gson:gson to v2.9.0 (#607)

* chore(deps): update dependency com.google.code.gson:gson to v2.9.0

* missing parameter

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>

* chore(deps): update node.js to v16.15.0 (#610)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* fix(deps): update docusaurus monorepo to v2.0.0-beta.21 (#602)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* Revert "fix(deps): update docusaurus monorepo to v2.0.0-beta.21 (#602)"

This reverts commit 8f3a702392c039ae35892d4faa3dd287a9dda021.

* update yarn

* fix(deps): update react monorepo to v18 (#599)

Co-authored-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Algolia Bot <30854082+algolia-bot@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants