Open Mikey-ShenSu opened 3 months ago
1.0.7
Darwin 23.4.0 arm64 arm
import { Elysia, t } from "elysia"; import { swagger } from "@elysiajs/swagger"; const app = new Elysia({ prefix: "/api" }) .use(swagger()) .get("/balance", async ({ set, headers }) => { console.log(headers); return "ok"; }) .compile(); export const GET = app.handle; export const POST = app.handle; export const PUT = app.handle; export const DELETE = app.handle; export type API = typeof app;
{ "name": "frontend", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@elysiajs/swagger": "^1.0.3", "elysia": "1.0.7", "next": "14.1.3", "react": "^18", "react-dom": "^18" }, "devDependencies": { "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.2.1", "postcss": "^8", "tailwindcss": "^3.4.1", "typescript": "^5" } }
{ accept: 'application/json, text/plain, */*', 'accept-encoding': 'gzip, deflate', 'accept-language': 'en-AU,en;q=0.9', connection: 'keep-alive', cookie: 'NEXT_LOCALE=en; bearerToken=Bearer eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjaGVja2VyMC5jb20iLCJ1c2VySWQiOiI1M2EyNTA2ZS1iOGQ0LTQzOTAtYWY3ZC0wNzg5NWJjMmMwNDQiLCJ1c2VybmFtZSI6Im1pa2V5NzUifQ.VhBHrKk40Cy8-O9Q8P6hp8SUOkxAOV7Ptyd3gXSTpc8', host: 'localhost:3000', referer: 'http://localhost:3000/api/swagger', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15', 'x-forwarded-for': '::1', 'x-forwarded-host': 'localhost:3000', 'x-forwarded-port': '3000', 'x-forwarded-proto': 'http' }
undefined
Code works fine on Dev mode, but not in production. And I have tried Elysia version 1.0.7 and latest, different next version 14.1.3 and latest, and still unable to retrieve the headers.
latest
14.1.3
Same bug here.
What version of Elysia.JS is running?
1.0.7
What platform is your computer?
Darwin 23.4.0 arm64 arm
What steps can reproduce the bug?
What is the expected behavior?
What do you see instead?
Additional information
Code works fine on Dev mode, but not in production. And I have tried Elysia version
1.0.7
andlatest
, different next version14.1.3
andlatest
, and still unable to retrieve the headers.