Open Balena: GET SyntaxError: Could not match resource

Intermittent errors on Open Balena API container, in the journalctl logs. Running v3.2.1. It results in CPU spikes which is how I came across it, but haven’t noticed any other repercussions:

Apr 22 03:19:24 b4a37b483439 api[982]: 2021-04-22T03:19:24.445Z 24.67.185.146 a/117 GET /resin/supervisor_release?$select=supervisor_version,image_name&$filter=should_manage__device/any(d:d/uuid%20eq%20'9
Apr 22 03:19:24 b4a37b483439 api[982]:     at handleODataRequest (/usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/sbvr-utils.ts:1089:21)
Apr 22 03:19:24 b4a37b483439 api[982]:     at /usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/sbvr-utils.ts:1024:20
Apr 22 03:19:24 b4a37b483439 api[982]:     at mapTill (/usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/control-flow.ts:45:19)
Apr 22 03:19:24 b4a37b483439 api[982]:     at /usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/sbvr-utils.ts:1030:16
Apr 22 03:19:24 b4a37b483439 api[982]:     at processTicksAndRejections (internal/process/task_queues.js:93:5)
Apr 22 03:19:24 b4a37b483439 api[982]:     at runMicrotasks (<anonymous>)
Apr 22 03:19:24 b4a37b483439 api[982]:     at prepareRequest (/usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/sbvr-utils.ts:1014:48)
Apr 22 03:19:24 b4a37b483439 api[982]:     at Object.translateUri (/usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/uri-parser.ts:404:28)
Apr 22 03:19:24 b4a37b483439 api[982]:     at /usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/uri-parser.ts:242:50
Apr 22 03:19:24 b4a37b483439 api[982]:     at /usr/src/app/node_modules/memoizee/lib/weak.js:87:21
Apr 22 03:19:24 b4a37b483439 api[982]:     at /usr/src/app/node_modules/memoizee/lib/configure-map.js:61:24
Apr 22 03:19:24 b4a37b483439 api[982]:     at /usr/src/app/node_modules/es5-ext/function/#/partial.js:12:16
Apr 22 03:19:24 b4a37b483439 api[982]:     at /usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/uri-parser.ts:165:43
Apr 22 03:19:24 b4a37b483439 api[982]:     at OData2AbstractSQL.match (/usr/src/app/node_modules/@balena/odata-to-abstract-sql/src/odata-to-abstract-sql.ts:337:24)
Apr 22 03:19:24 b4a37b483439 api[982]:     at OData2AbstractSQL.PathSegment (/usr/src/app/node_modules/@balena/odata-to-abstract-sql/src/odata-to-abstract-sql.ts:383:25)
Apr 22 03:19:24 b4a37b483439 api[982]:     at OData2AbstractSQL.Resource (/usr/src/app/node_modules/@balena/odata-to-abstract-sql/src/odata-to-abstract-sql.ts:751:10)
Apr 22 03:19:24 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 22 03:19:24 b4a37b483439 api[982]:         }
Apr 22 03:19:24 b4a37b483439 api[982]:                 }
Apr 22 03:19:24 b4a37b483439 api[982]:                         }
Apr 22 03:19:24 b4a37b483439 api[982]:                                 "method": "any"
Apr 22 03:19:24 b4a37b483439 api[982]:                                 "identifier": "d",
Apr 22 03:19:24 b4a37b483439 api[982]:                                 ],
Apr 22 03:19:24 b4a37b483439 api[982]:                                         }
Apr 22 03:19:24 b4a37b483439 api[982]:                                                 "bind": 0
Apr 22 03:19:24 b4a37b483439 api[982]:                                         {
Apr 22 03:19:24 b4a37b483439 api[982]:                                         },
Apr 22 03:19:24 b4a37b483439 api[982]:                                                 "count": null
Apr 22 03:19:24 b4a37b483439 api[982]:                                                 },
Apr 22 03:19:24 b4a37b483439 api[982]:                                                         "count": null
Apr 22 03:19:24 b4a37b483439 api[982]:                                                         "property": null,
Apr 22 03:19:24 b4a37b483439 api[982]:                                                         "name": "uuid",
Apr 22 03:19:24 b4a37b483439 api[982]:                                                 "property": {
Apr 22 03:19:24 b4a37b483439 api[982]:                                                 "name": "d",
Apr 22 03:19:24 b4a37b483439 api[982]:                                         {
Apr 22 03:19:24 b4a37b483439 api[982]:                                         "eq",
Apr 22 03:19:24 b4a37b483439 api[982]:                                 "expression": [
Apr 22 03:19:24 b4a37b483439 api[982]:                         "lambda": {
Apr 22 03:19:24 b4a37b483439 api[982]:                         "name": "should_manage__device",
Apr 22 03:19:24 b4a37b483439 api[982]:                 "$filter": {
Apr 22 03:19:24 b4a37b483439 api[982]:                 },
Apr 22 03:19:24 b4a37b483439 api[982]:                         ]
Apr 22 03:19:24 b4a37b483439 api[982]:                                 }
Apr 22 03:19:24 b4a37b483439 api[982]:                                         "count": null
Apr 22 03:19:24 b4a37b483439 api[982]:                                         "property": null,
Apr 22 03:19:24 b4a37b483439 api[982]:                                         "name": "image_name",
Apr 22 03:19:24 b4a37b483439 api[982]:                                 {
Apr 22 03:19:24 b4a37b483439 api[982]:                                 },
Apr 22 03:19:24 b4a37b483439 api[982]:                                         "count": null
Apr 22 03:19:24 b4a37b483439 api[982]:                                         "property": null,
Apr 22 03:19:24 b4a37b483439 api[982]:                                         "name": "supervisor_version",
Apr 22 03:19:24 b4a37b483439 api[982]:                                 {
Apr 22 03:19:24 b4a37b483439 api[982]:                         "properties": [
Apr 22 03:19:24 b4a37b483439 api[982]:                 "$select": {
Apr 22 03:19:24 b4a37b483439 api[982]:         "options": {
Apr 22 03:19:24 b4a37b483439 api[982]:         "resource": "supervisor_release",
Apr 22 03:19:24 b4a37b483439 api[982]: Failed to translate url:  {

Seems like it happens at unpredictable intervals:

Apr 12 23:56:51 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 13 01:53:38 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 13 06:40:35 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 14 06:40:40 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 15 06:40:44 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 16 06:40:49 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 17 06:40:53 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 19 03:19:11 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 20 03:19:15 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 21 03:19:19 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 22 03:19:24 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource

Hello, looks like that request line is truncated, but the device id begins with 9. Are you able to manually run this request from the command line using curl with the correct uuid and see what the API responds with please:

curl "https://api.<your-open-balena.tld>/resin/supervisor_release?\$filter=should_manage__device/any(d:d/uuid%20eq%20'<your-device-id>')" -H "Content-Type: application/json" -H "Authorization: Bearer <your-api-token-or-session-token-from-dashboard>"

This is for OpenBalena. What/where would ‘your-api-token-or-session-token-from-dashboard’ be?

I also have a device id 964f2e39faea9920d7fa3574936f3bd6, which I assume is the one it is trying. The error isn’t caused by any particular action though, so not really sure what it is trying to do when the error occurs, or what device it is doing it to.

And may have been me not copying the logs correctly. Here is another without truncation and as it appears in the logs:

Apr 29 03:19:41 b4a37b483439 api[982]: 2021-04-29T03:19:41.329Z 172.20.0.8 s/vpn PATCH /resin/service_instance(71) 200 35.734ms -
Apr 29 03:19:51 b4a37b483439 api[982]: 2021-04-29T03:19:51.363Z 172.20.0.8 s/vpn PATCH /resin/service_instance(71) 200 21.071ms -
Apr 29 03:19:53 b4a37b483439 api[982]: Failed to translate url:  {
Apr 29 03:19:53 b4a37b483439 api[982]:         "resource": "supervisor_release",
Apr 29 03:19:53 b4a37b483439 api[982]:         "options": {
Apr 29 03:19:53 b4a37b483439 api[982]:                 "$select": {
Apr 29 03:19:53 b4a37b483439 api[982]:                         "properties": [
Apr 29 03:19:53 b4a37b483439 api[982]:                                 {
Apr 29 03:19:53 b4a37b483439 api[982]:                                         "name": "supervisor_version",
Apr 29 03:19:53 b4a37b483439 api[982]:                                         "property": null,
Apr 29 03:19:53 b4a37b483439 api[982]:                                         "count": null
Apr 29 03:19:53 b4a37b483439 api[982]:                                 },
Apr 29 03:19:53 b4a37b483439 api[982]:                                 {
Apr 29 03:19:53 b4a37b483439 api[982]:                                         "name": "image_name",
Apr 29 03:19:53 b4a37b483439 api[982]:                                         "property": null,
Apr 29 03:19:53 b4a37b483439 api[982]:                                         "count": null
Apr 29 03:19:53 b4a37b483439 api[982]:                                 }
Apr 29 03:19:53 b4a37b483439 api[982]:                         ]
Apr 29 03:19:53 b4a37b483439 api[982]:                 },
Apr 29 03:19:53 b4a37b483439 api[982]:                 "$filter": {
Apr 29 03:19:53 b4a37b483439 api[982]:                         "name": "should_manage__device",
Apr 29 03:19:53 b4a37b483439 api[982]:                         "lambda": {
Apr 29 03:19:53 b4a37b483439 api[982]:                                 "expression": [
Apr 29 03:19:53 b4a37b483439 api[982]:                                         "eq",
Apr 29 03:19:53 b4a37b483439 api[982]:                                         {
Apr 29 03:19:53 b4a37b483439 api[982]:                                                 "name": "d",
Apr 29 03:19:53 b4a37b483439 api[982]:                                                 "property": {
Apr 29 03:19:53 b4a37b483439 api[982]:                                                         "name": "uuid",
Apr 29 03:19:53 b4a37b483439 api[982]:                                                         "property": null,
Apr 29 03:19:53 b4a37b483439 api[982]:                                                         "count": null
Apr 29 03:19:53 b4a37b483439 api[982]:                                                 },
Apr 29 03:19:53 b4a37b483439 api[982]:                                                 "count": null
Apr 29 03:19:53 b4a37b483439 api[982]:                                         },
Apr 29 03:19:53 b4a37b483439 api[982]:                                         {
Apr 29 03:19:53 b4a37b483439 api[982]:                                                 "bind": 0
Apr 29 03:19:53 b4a37b483439 api[982]:                                         }
Apr 29 03:19:53 b4a37b483439 api[982]:                                 ],
Apr 29 03:19:53 b4a37b483439 api[982]:                                 "identifier": "d",
Apr 29 03:19:53 b4a37b483439 api[982]:                                 "method": "any"
Apr 29 03:19:53 b4a37b483439 api[982]:                         }
Apr 29 03:19:53 b4a37b483439 api[982]:                 }
Apr 29 03:19:53 b4a37b483439 api[982]:         }
Apr 29 03:19:53 b4a37b483439 api[982]: } GET SyntaxError: Could not match resource
Apr 29 03:19:53 b4a37b483439 api[982]:     at OData2AbstractSQL.Resource (/usr/src/app/node_modules/@balena/odata-to-abstract-sql/src/odata-to-abstract-sql.ts:751:10)
Apr 29 03:19:53 b4a37b483439 api[982]:     at OData2AbstractSQL.PathSegment (/usr/src/app/node_modules/@balena/odata-to-abstract-sql/src/odata-to-abstract-sql.ts:383:25)
Apr 29 03:19:53 b4a37b483439 api[982]:     at OData2AbstractSQL.match (/usr/src/app/node_modules/@balena/odata-to-abstract-sql/src/odata-to-abstract-sql.ts:337:24)
Apr 29 03:19:53 b4a37b483439 api[982]:     at /usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/uri-parser.ts:165:43
Apr 29 03:19:53 b4a37b483439 api[982]:     at /usr/src/app/node_modules/es5-ext/function/#/partial.js:12:16
Apr 29 03:19:53 b4a37b483439 api[982]:     at /usr/src/app/node_modules/memoizee/lib/configure-map.js:61:24
Apr 29 03:19:53 b4a37b483439 api[982]:     at /usr/src/app/node_modules/memoizee/lib/weak.js:87:21
Apr 29 03:19:53 b4a37b483439 api[982]:     at /usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/uri-parser.ts:242:50
Apr 29 03:19:53 b4a37b483439 api[982]:     at Object.translateUri (/usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/uri-parser.ts:404:28)
Apr 29 03:19:53 b4a37b483439 api[982]:     at prepareRequest (/usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/sbvr-utils.ts:1014:48)
Apr 29 03:19:53 b4a37b483439 api[982]:     at processTicksAndRejections (internal/process/task_queues.js:93:5)
Apr 29 03:19:53 b4a37b483439 api[982]:     at /usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/sbvr-utils.ts:1030:16
Apr 29 03:19:53 b4a37b483439 api[982]:     at mapTill (/usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/control-flow.ts:45:19)
Apr 29 03:19:53 b4a37b483439 api[982]:     at /usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/sbvr-utils.ts:1024:20
Apr 29 03:19:53 b4a37b483439 api[982]:     at handleODataRequest (/usr/src/app/node_modules/@balena/pinejs/src/sbvr-api/sbvr-utils.ts:1089:21)
Apr 29 03:19:53 b4a37b483439 api[982]: 2021-04-29T03:19:53.481Z 24.67.185.146 a/117 GET /resin/supervisor_release?$select=supervisor_version,image_name&$filter=should_manage__device/any(d:d/uuid%20eq%20'964f2e39faea9920d7fa3574936f3bd6') 500 35.863ms -

I’m not really sure what the command that is failing does. But a few unique environmental factors sprung to mind. This device is an orange pi zero using the image from the staging page run on open balena. Not sure if the fact it is a staging image makes a difference.