Skip to content

CF worker tracebacks #51

@samuelcolvin

Description

@samuelcolvin

The tracebacks shown in the terminal for errors in cloudflare workers running locally, show the actual path in typescript, where as the traceback in logfire from logfire-js shows JS paths, which are not helpful.

Is there a way to get hold of the more useful paths?

Example

terminal traceback:

✘ [ERROR] Internal Server Error: TypeError: Cannot read properties of undefined (reading 'map')

      at otelEvents
  (file:///Users/samuel/code/pydantic-ai-gateway/packages/gateway/src/providers/google/otel.ts:30:38)
      at GoogleVertexProvider.otelEvents
  (file:///Users/samuel/code/pydantic-ai-gateway/packages/gateway/src/providers/google/index.ts:39:12)
      at GoogleVertexProvider.dispatch
  (file:///Users/samuel/code/pydantic-ai-gateway/packages/gateway/src/providers/default.ts:227:24)
      at async gateway
  (file:///Users/samuel/code/pydantic-ai-gateway/packages/gateway/src/gateway.ts:33:18)
      at async gatewayFetch
  (file:///Users/samuel/code/pydantic-ai-gateway/packages/gateway/src/index.ts:23:14)
      at async fetch (file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/src/index.ts:20:14)
      at null.<anonymous> (async
  file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/.wrangler/tmp/dev-z9Fy0V/index.js:21342:24)
      at async Object.apply
  (file:///Users/samuel/code/pydantic-ai-gateway/node_modules/@pydantic/otel-cf-workers/src/instrumentation/fetch.ts:198:12)
      at async jsonError
  (file:///Users/samuel/code/pydantic-ai-gateway/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts:22:10)
      at async drainBody
  (file:///Users/samuel/code/pydantic-ai-gateway/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts:5:10)

Logfire traceback:

TypeError: Cannot read properties of undefined (reading 'map')
    at otelEvents (file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/.wrangler/tmp/dev-z9Fy0V/index.js:33665:38)
    at GoogleVertexProvider.otelEvents (file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/.wrangler/tmp/dev-z9Fy0V/index.js:33866:12)
    at GoogleVertexProvider.dispatch (file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/.wrangler/tmp/dev-z9Fy0V/index.js:33141:24)
    at async gateway (file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/.wrangler/tmp/dev-z9Fy0V/index.js:34581:18)
    at async gatewayFetch (file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/.wrangler/tmp/dev-z9Fy0V/index.js:34757:14)
    at async fetch (file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/.wrangler/tmp/dev-z9Fy0V/index.js:34913:14)
    at async file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/.wrangler/tmp/dev-z9Fy0V/index.js:21342:24
    at async Object.apply (file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/.wrangler/tmp/dev-z9Fy0V/index.js:21371:16)
    at async jsonError (file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/.wrangler/tmp/dev-z9Fy0V/index.js:34966:12)
    at async drainBody (file:///Users/samuel/code/pydantic-ai-gateway/oss-gateway/.wrangler/tmp/dev-z9Fy0V/index.js:34935:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions