Skip to content

context.request is undefined when using in trace #36

@AlisaAkiron

Description

@AlisaAkiron

What version of Elysia is running?

1.2.25

What version of Node Adapter are you using?

1.2.6

What platform is your computer?

Darwin 24.4.0 arm64 arm

What steps can reproduce the bug?

Create an elysia app with pnpm. Then put these codes in main.ts file.

import { node } from "@elysiajs/node";
import { Elysia } from "elysia";

new Elysia({ adapter: node() })
	.trace(({ context: { request } }) => {
		console.log(`Request in trace is: ${request}`);
	})
	.get("/", () => ({ hello: "Node.js👋" }))
	.listen(3000);

console.log("Listening on http://localhost:3000");

Running the app, then send request to http://localhost:3000, this log message will appear in the console: Request in trace is: undefined

What is the expected behavior?

Request should not be undefined

What do you see instead?

No response

Additional information

This problem also cause the opentelemetry plugin to stop working because it will try to get HTTP request method from context.request.method here:

https://github.com/elysiajs/opentelemetry/blob/f89eda99c4b50b3e9cc3b1bf5f634368902439d9/src/index.ts#L294

Have you try removing the node_modules and bun.lockb and try again yet?

Yes but the pnpm-lock.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions