You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a few apps in TT02 and Production, GET instances?appId={app-with-some-corrupt-instances} results in 400 Bad Request with message "The JSON value could not be converted to Altinn.Platform.Storage.Interface.Models.Instance. Path: $ | LineNumber: 0 | BytePositionInLine: 1." Link to Slack post that made us aware of this - includes discussion on possible causes.
When these few corrupt instances are included in a query for instances, the deserialization from JSON to .NET class fails. Currently, this breaks the whole query, thus making the requested data unavailable.
The corrupt instances can be found in the DB table storage.instances of tt02 and prod, as rows where the instance jsonb element has the structure of [ { "id": "..", etc. }, "2024-..." ]
instead of { "id": "...", etc. } .
You can query the instances by running select * from storage.instances where jsonb_typeof(instance) ='array' order by created asc
Steps To Reproduce
Run GET storage/api/v1/instances?appId=krt/krt-1064a-1 or GET storage/api/v1/instances?appId=ttd/frontend-test in TT02
Scope
Correct the corrupt instances, so that the jsonb data have the expected structure.
While we also want to change the functionality of filtering out such broken data in this endpoint, thus allowing normal instances to be returned with 200 OK, this functional change is to be addressed in a separate issue (#604)
Proposed solution
Run a script that updates the instances in question, row by row. Start with AT envs (if we can find corrupt instances there as well), then TT envs, and Production lastly
Additional information
There are 6 known instances in AT23, 30 in TT02, and 8 in Production.
hggutvik
changed the title
Corrupt instances are breaking GET instances, making related data unavailable
GET instances fails when query includes corrupt jsonb instances
Jan 22, 2025
Description of the bug
For a few apps in TT02 and Production,
GET instances?appId={app-with-some-corrupt-instances}
results in 400 Bad Request with message"The JSON value could not be converted to Altinn.Platform.Storage.Interface.Models.Instance. Path: $ | LineNumber: 0 | BytePositionInLine: 1."
Link to Slack post that made us aware of this - includes discussion on possible causes.
When these few corrupt instances are included in a query for instances, the deserialization from JSON to .NET class fails. Currently, this breaks the whole query, thus making the requested data unavailable.
The corrupt instances can be found in the DB table storage.instances of tt02 and prod, as rows where the instance jsonb element has the structure of
[ { "id": "..", etc. }, "2024-..." ]
instead of
{ "id": "...", etc. }
.You can query the instances by running
select * from storage.instances where jsonb_typeof(instance) ='array' order by created asc
Steps To Reproduce
Run
GET storage/api/v1/instances?appId=krt/krt-1064a-1
orGET storage/api/v1/instances?appId=ttd/frontend-test
in TT02Scope
Correct the corrupt instances, so that the jsonb data have the expected structure.
While we also want to change the functionality of filtering out such broken data in this endpoint, thus allowing normal instances to be returned with 200 OK, this functional change is to be addressed in a separate issue (#604)
Proposed solution
Run a script that updates the instances in question, row by row. Start with AT envs (if we can find corrupt instances there as well), then TT envs, and Production lastly
Additional information
There are 6 known instances in AT23, 30 in TT02, and 8 in Production.
Relevant resource for updating jsonb data: https://www.postgresql.org/docs/current/datatype-json.html
The text was updated successfully, but these errors were encountered: