Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

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

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Invalid time value exception when syncing #1803

Closed
Mikescher opened this issue Jun 6, 2022 · 1 comment
Closed

Invalid time value exception when syncing #1803

Mikescher opened this issue Jun 6, 2022 · 1 comment

Comments

@Mikescher
Copy link

Mikescher commented Jun 6, 2022

Due to a bug in my client (AlephNote) I managed to create tags with the creation_date 1-01-01T00:00:00.00000000Z, when I then try to open the account in the web app I get a js exception and the sync process does not finish.

While this is definitely a bug in my program (or is it?) it would be nice if the dateToLocalizedString could be adjusted to not crash on weird values.

The sync data

The Data I send (everything is on a newly created test account):

    {
      "uuid": "c1e87da1-c612-4c03-8b5c-a01025728d94",
      "content_type": "Tag",
      "content": "003:182b55b73d84be5e5f89eccba91830f33bea55288175c8ee1ed4fe244ad6831e:c1e87da1-c612-4c03-8b5c-a01025728d94:a1777e1747bca1a2d62039b9f288a2a4:JVosDvF7SgxHxuIod4vzJCjTcD/oVAjoGi9UZuvHFyF/aJFC7GP60ZPqQ1P0R0TgKXMgoehgvNZAV9P/k56jz5/ZCm2xP6GTRyOvAWUB96KGZFBfk7Xy6+n72nwcuV9dXMy8gP3Jj+XwvzgTMLKH09vf5P04Vh6wrfsMx/LYq+8=",
      "enc_item_key": "003:ac4ede6c31fcbd8a305f9c00cb79cc208add479aeffd8e33d6b08b33d335f1dd:c1e87da1-c612-4c03-8b5c-a01025728d94:86feb89464706a5b34bebc36c8331e6b:9Ien+QhbNXl2IxY9LJasa8F23xClFlNzMyAzDOKsZAKmYC34TPe0SaZc6YyLTJtSZGCud/GBr0wR/G4Z/UqOJyrAgmlSwrmxAO6veP+YG6oZKD76pyMdqdt5ACszYqgiVOWZqidpF3Yp37K1J+aM2y9BfEGYVGAa8J0jJR5zSbwOWmreObV3e2XvIFgZBMku",
      "auth_hash": null,
      "items_key_id": null,
      "created_at": "0001-01-01T00:00:00.0000000Z",
      "updated_at": "0001-01-01T00:00:00.0000000Z",
      "deleted": false
    }

The data I receive:

    {
      "uuid": "c1e87da1-c612-4c03-8b5c-a01025728d94",
      "duplicate_of": null,
      "content_type": "Tag",
      "auth_hash": null,
      "deleted": false,
      "created_at": "1-01-01T00:00:00.00000000Z",
      "created_at_timestamp": -62135596800000000,
      "updated_at": "2022-06-06T19:40:05.750946Z",
      "updated_at_timestamp": 1654544405750946
    }

(updated_at gets set from the server, but created_at not?)

The js exception (developer console)

Sync handle response error RangeError: Invalid time value
    at t.dateToLocalizedString (app-77e7cec1397f1069e39f608766cdc710486d6248c90b6481a85a301e1c8fb242.js:2)
    at new t.GenericItem (app-77e7cec1397f1069e39f608766cdc710486d6248c90b6481a85a301e1c8fb242.js:2)
    at new c (app-77e7cec1397f1069e39f608766cdc710486d6248c90b6481a85a301e1c8fb242.js:2)
    at new a (app-77e7cec1397f1069e39f608766cdc710486d6248c90b6481a85a301e1c8fb242.js:2)
    at B (app-77e7cec1397f1069e39f608766cdc710486d6248c90b6481a85a301e1c8fb242.js:2)
    at Object.t.CreateItemFromPayload (app-77e7cec1397f1069e39f608766cdc710486d6248c90b6481a85a301e1c8fb242.js:2)
    at l (app-77e7cec1397f1069e39f608766cdc710486d6248c90b6481a85a301e1c8fb242.js:2)
    at app-77e7cec1397f1069e39f608766cdc710486d6248c90b6481a85a301e1c8fb242.js:2
    at Array.map (<anonymous>)
    at Ue.setPayloads (app-77e7cec1397f1069e39f608766cdc710486d6248c90b6481a85a301e1c8fb242.js:2)

Steps to reproduce

  • Create a new account
  • Create a new note with AlephNote
  • Create a new tag with AlephNote
  • sync
  • Try to log into the account on https://app.standardnotes.org/
  • Open the web-console (or notice that some notes/tags are missing)

Also I'm kinda sure that the creation-date of items was previously not supplied by the client but automatically set from the server (thats why I could always just send DateTimeOffset.Min) - Did the API behaviour change or is this a bug I should report elsewhere?

 

Regards
~Mike

@moughxyz
Copy link
Member

Hmm, we'll have to look into this. PR welcome :)

Did the API behaviour change or

Created at is set by the client. Updated at is set by the server.

@moughxyz moughxyz transferred this issue from standardnotes/app Sep 29, 2022
@standardnotes standardnotes locked and limited conversation to collaborators Feb 21, 2023
@myreli myreli converted this issue into discussion #2802 Feb 21, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants