Skip to content

(bun + hono) "http://172.31.12.14480/ruok" cannot be parsed as a URL. #9673

@morpig

Description

@morpig

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/bun

SDK Version

7.81.1

Framework Version

bun 1.0.14

Link to Sentry event

No response

SDK Setup

Sentry.init({
    dsn: dsn,
    environment: (is_prod) ? 'prod' : 'dev',
    release: git.short(),
    attachStacktrace: true,
    sampleRate: 1.0,
    tracesSampleRate: 0.1,
    debug: false
});

Steps to Reproduce

Running bun + hono (web framework) in kubernetes environment, health check is executed every x-second to /ruok endpoint.

Sentry is spitting out constant "http://172.31.12.14480/ruok" cannot be parsed as a URL. errors from health check request.

From the error message, the URL string itself is invalid (look at IP format.) Tried digging deeper to the request data, nothing seems abnormal.

Screenshot 2023-11-28 at 01 35 39

request data:

Context {
  env: DebugHTTPServer {
    address: {
      address: "::",
      family: "IPv6",
      port: 8080
    },
    development: true,
    fetch: [Function: fetch],
    hostname: "localhost",
    id: "",
    pendingRequests: 1,
    pendingWebSockets: 0,
    port: 8080,
    protocol: "http",
    publish: [Function: publish],
    reload: [Function: reload],
    requestIP: [Function: requestIP],
    stop: [Function: stop],
    upgrade: [Function: upgrade],
    url: URL {
      href: "http://localhost:8080/",
      origin: "http://localhost:8080",
      protocol: "http:",
      username: "",
      password: "",
      host: "localhost:8080",
      hostname: "localhost",
      port: "8080",
      pathname: "/",
      hash: "",
      search: "",
      searchParams: [URLSearchParams ...],
      toJSON: [Function: toJSON],
      toString: [Function: toString]
    }
  },
  _var: {},
  finalized: false,
  error: undefined,
  _status: 200,
  _h: undefined,
  _pH: undefined,
  _init: true,
  _renderer: [Function],
  notFoundHandler: [Function: notFoundHandler],
  render: [Function],
  setRenderer: [Function],
  header: [Function],
  status: [Function],
  set: [Function],
  get: [Function],
  newResponse: [Function],
  body: [Function],
  text: [Function],
  json: [Function],
  jsonT: [Function],
  html: [Function],
  redirect: [Function],
  streamText: [Function],
  stream: [Function],
  cookie: [Function],
  notFound: [Function],
  req: HonoRequest {
    _p: {},
    bodyCache: {},
    cachedBody: [Function],
    raw: Request (0 KB) {
      method: "GET",
      url: "http://172.31.12.144:8080/ruok",
      headers: Headers {
        "host": "172.31.12.144:8080",
        "user-agent": "k8s-readiness-probe",
        "accept": "*/*",
        "connection": "close",
        "accept-encoding": "gzip"
      }
    },
    path: "/ruok",
    _s: [],
    vData: {},
    setParams: [Function: setParams],
    param: [Function: param],
    query: [Function: query],
    queries: [Function: queries],
    header: [Function: header],
    cookie: [Function: cookie],
    parseBody: [Function: parseBody],
    json: [Function: json],
    text: [Function: text],
    arrayBuffer: [Function: arrayBuffer],
    blob: [Function: blob],
    formData: [Function: formData],
    addValidatedData: [Function: addValidatedData],
    valid: [Function: valid],
    url: [Getter],
    method: [Getter],
    headers: [Getter],
    body: [Getter],
    bodyUsed: [Getter],
    integrity: [Getter],
    keepalive: [Getter],
    referrer: [Getter],
    signal: [Getter]
  },
  _exCtx: undefined,
  event: [Getter],
  executionCtx: [Getter],
  res: [Getter],
  var: [Getter],
  runtime: [Getter]
}
const Sentry = require('@sentry/bun');

Sentry.init({
    dsn: 'https://dsn',
    environment: (is_prod) ? 'prod' : 'dev',
    release: git.short(),
    attachStacktrace: true,
    sampleRate: 1.0,
    tracesSampleRate: 0.1,
    debug: false
});

const { Hono } = require('hono');
const app = new Hono();

app.get('/ruok', async(c) => {
    console.log(c);
    return c.json({ message: 'ok' }, 200);
});

export default {
    port: 8080,
    fetch: app.fetch,
}

Expected Result

Sentry shouldn't spit out any errors.

Actual Result

attached

Metadata

Metadata

Assignees

Labels

Package: bunIssues related to the Sentry Bun SDK

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions