evanderkoogh / otel-cf-workers

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

Bug when trying to access undefined env vars #9

Closed lboynton closed 1 year ago

lboynton commented 1 year ago

First, thanks for the library!

Now, one issue I've found is that because it wraps env, I can no longer try to access env vars that haven't been set. If I do I get the following error:

Cannot read properties of undefined (reading 'getWithMetadata')

This is coming from this line. This should be quite straight-forward to fix simply by returning false if it's undefined. I'll raise a PR if I get some time.