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

AppEngine: Milliseconds are dropped from query parameters #620

Closed
Annopaolo opened this issue Oct 7, 2021 · 1 comment
Closed

AppEngine: Milliseconds are dropped from query parameters #620

Annopaolo opened this issue Oct 7, 2021 · 1 comment
Labels
API This issue or pull request is about API (e.g. unclear API, new API, API change, deprecation) app:appengine_api This issue or pull request is about astarte_appengine_api application

Comments

@Annopaolo
Copy link
Collaborator

Annopaolo commented Oct 7, 2021

I published some data on interface com.samples.Example with device 2Qcgg5oKQJWOzVXrKnUsNg.

$ curl -X GET http://localhost:4002/v1/test/devices/2Qcgg5oKQJWOzVXrKnUsNg/interfaces/com.samples.GPS -H  "accept: */*" -H  "Authorization: Bearer $JWT"
{"data":{"sensors":{"gps":[{"timestamp":"2021-10-06T14:12:50.722Z","x":43.0,"y":11.0,"z":3.0},{"timestamp":"2021-10-06T14:13:20.320Z","x":45.0,"y":12.0,"z":3.0},{"timestamp":"2021-10-06T14:13:51.403Z","x":45.0,"y":12.0,"z":3.0}]}}}

When, for example, I try to retrieve the last one using a since param, I get the following:

$ curl -X GET http://localhost:4002/v1/test/devices/2Qcgg5oKQJWOzVXrKnUsNg/interfaces/com.samples.GPS?since=2021-10-06T14:13:51.403Z -H  "accept: */*" -H  "Authorization: Bearer $JWT"
{"data":{"sensors":{"gps":[{"timestamp":"2021-10-06T14:13:51.403Z","x":45.0,"y":12.0,"z":3.0}]}}}

Then, if I change the milliseconds value in the query 403Z to 999Z, I still get the same result:

$ curl -X GET http://localhost:4002/v1/test/devices/2Qcgg5oKQJWOzVXrKnUsNg/interfaces/com.samples.GPS?since=2021-10-06T14:13:51.999Z -H  "accept: */*" -H  "Authorization: Bearer $JWT"
{"data":{"sensors":{"gps":[{"timestamp":"2021-10-06T14:13:51.403Z","x":45.0,"y":12.0,"z":3.0}]}}}

Which is obviously wrong, because the message was sent before the since value.
If I change the seconds value instead, the query correctly returns no data.
I suspect milli/microseconds values are dropped from the query.
This might relate to #553.

@Annopaolo Annopaolo added API This issue or pull request is about API (e.g. unclear API, new API, API change, deprecation) app:appengine_api This issue or pull request is about astarte_appengine_api application labels Oct 7, 2021
Annopaolo added a commit to Annopaolo/astarte that referenced this issue Oct 7, 2021
…ince_after` params.

Use `utc_datetime_usec` instead of `utc_datetime` in query params changeset
as `utc_datetime` no longer keeps microseconds information since Ecto 3.0.0.
Fix [astarte-platform#620](astarte-platform#620).

Signed-off-by: Arnaldo Cesco <arnaldo.cesco@ispirata.com>
Annopaolo added a commit to Annopaolo/astarte that referenced this issue Oct 7, 2021
…ince_after` params.

Use `utc_datetime_usec` instead of `utc_datetime` in query params changeset
as `utc_datetime` no longer keeps microseconds information since Ecto 3.0.0.
Fix [astarte-platform#620](astarte-platform#620).

Signed-off-by: Arnaldo Cesco <arnaldo.cesco@ispirata.com>
Annopaolo added a commit to Annopaolo/astarte that referenced this issue Oct 7, 2021
…ince_after` params.

Use `utc_datetime_usec` instead of `utc_datetime` in query params changeset
as `utc_datetime` no longer keeps microseconds information since Ecto 3.0.0.
Fix [astarte-platform#620](astarte-platform#620).

Signed-off-by: Arnaldo Cesco <arnaldo.cesco@ispirata.com>
@Annopaolo
Copy link
Collaborator Author

Closed by #621.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API This issue or pull request is about API (e.g. unclear API, new API, API change, deprecation) app:appengine_api This issue or pull request is about astarte_appengine_api application
Projects
None yet
Development

No branches or pull requests

1 participant