evanderkoogh / otel-cf-workers

An OpenTelemetry compatible library for instrumenting and exporting traces for Cloudflare Workers
BSD 3-Clause "New" or "Revised" License
239 stars 50 forks source link

DurableObjectStorage list with no args throws runtime error #33

Closed rtbenfield closed 1 year ago

rtbenfield commented 1 year ago

Description

When using an instrumented Durable Object, calling storage.list() without supplying any arguments will throw TypeError: Cannot set properties of undefined (setting 'do.storage.number_of_results').

This is caused by the instrumentation of DurableObjectStorage attempting to mutate the first argument, which does not exist in this case.

Workaround

The workaround for this is simply to pass an empty object like storage.list({}).