powersync-ja / powersync-service

Other
123 stars 9 forks source link

"PlanExecutor error during aggregation :: caused by :: Unable to retrieve storageStats in $collStats stage :: caused by :: Collection [powersync_demo.bucket_data] not found." #81

Closed Dieterbe closed 1 month ago

Dieterbe commented 1 month ago

while building my app locally in docker, i saw errors such as these:

powersync-1      | {"$clusterTime":{"clusterTime":{"$timestamp":"7414489909525741572"},"signature":{"hash":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","keyId":"0"}},"code":26,"codeName":"NamespaceNotFound","errorResponse":{"$clusterTime":{"clusterTime":{"$timestamp":"7414489909525741572"},"signature":{"hash":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","keyId":"0"}},"code":26,"codeName":"NamespaceNotFound","errmsg":"PlanExecutor error during aggregation :: caused by :: Unable to retrieve storageStats in $collStats stage :: caused by :: Collection [powersync_demo.bucket_data] not found.","ok":0,"operationTime":{"$timestamp":"7414489909525741572"}},"level":"error","message":"Failed to get storage metrics PlanExecutor error during aggregation :: caused by :: Unable to retrieve storageStats in $collStats stage :: caused by :: Collection [powersync_demo.bucket_data] not found.","ok":0,"operationTime":{"$timestamp":"7414489909525741572"},"stack":"MongoServerError: PlanExecutor error during aggregation :: caused by :: Unable to retrieve storageStats in $collStats stage :: caused by :: Collection [powersync_demo.bucket_data] not found.\n    at Connection.sendCommand (/app/node_modules/.pnpm/mongodb@6.7.0_socks@2.8.3/node_modules/mongodb/lib/cmap/connection.js:297:27)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Connection.command (/app/node_modules/.pnpm/mongodb@6.7.0_socks@2.8.3/node_modules/mongodb/lib/cmap/connection.js:325:26)\n    at async Server.command (/app/node_modules/.pnpm/mongodb@6.7.0_socks@2.8.3/node_modules/mongodb/lib/sdam/server.js:166:24)\n    at async AggregateOperation.executeCommand (/app/node_modules/.pnpm/mongodb@6.7.0_socks@2.8.3/node_modules/mongodb/lib/operations/command.js:74:16)\n    at async AggregateOperation.execute (/app/node_modules/.pnpm/mongodb@6.7.0_socks@2.8.3/node_modules/mongodb/lib/operations/aggregate.js:85:21)\n    at async executeOperation (/app/node_modules/.pnpm/mongodb@6.7.0_socks@2.8.3/node_modules/mongodb/lib/operations/execute_operation.js:136:16)\n    at async AggregationCursor._initialize (/app/node_modules/.pnpm/mongodb@6.7.0_socks@2.8.3/node_modules/mongodb/lib/cursor/aggregation_cursor.js:46:26)\n    at async [kInit] (/app/node_modules/.pnpm/mongodb@6.7.0_socks@2.8.3/node_modules/mongodb/lib/cursor/abstract_cursor.js:463:27)\n    at async next (/app/node_modules/.pnpm/mongodb@6.7.0_socks@2.8.3/node_modules/mongodb/lib/cursor/abstract_cursor.js:520:13)","timestamp":"2024-09-14T13:27:40.406Z"}

this error is pretty unclear to someone without a deep understanding of how powersync works. i suggest making it more clear. is this only caused when no data is replicating yet? maybe issue a warning instead of an error? maybe tell the user they need to look at their sync rules and postgres publication?

stevensJourney commented 1 month ago

From here it seems like this error log is the result of no data having been replicated yet. We will add the enhancement of logs like this to our Engineering backlog