-
-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
1.3.21
What version of Node Adapter are you using?
1.3.1
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What steps can reproduce the bug?
My server.ts
import { Elysia } from "elysia";
import { node } from "@elysiajs/node";
import { cors } from "@elysiajs/cors";
import orm from "./database/orm.js";
import { RequestContext, Utils, wrap } from "@mikro-orm/core";
import auth from "./auth.js";
import env from "./env.js";
import { fstat, read, readFileSync } from "fs";
const app = new Elysia({
adapter: node(),
serve: {
hostname: "0.0.0.0",
tls: {
cert: readFileSync("../../cert.pem"),
key: readFileSync("../../key.pem"),
},
},
})
.decorate("orm", orm)
.on("beforeHandle", () => RequestContext.enter(orm.em))
.on("afterHandle", ({ response }) =>
Utils.isEntity(response) ? wrap(response).toObject() : response,
)
///#region BetterAuth
.use(
cors({
origin: env.FRONTEND_URL,
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
credentials: true,
allowedHeaders: ["Content-Type", "Authorization"],
}),
)
.mount(auth.handler)
.macro({
auth: {
async resolve({ status, request: { headers } }) {
const session = await auth.api.getSession({
headers,
});
if (!session) return status(401);
return {
user: session.user,
session: session.session,
};
},
},
})
///#endregion
.listen(
{
port: 3001,
tls: {
cert: readFileSync("../../cert.pem"),
key: readFileSync("../../key.pem"),
},
},
({ hostname, port }) => {
console.log(`🦊 Elysia is running at ${hostname}:${port}`);
},
);The pem file could be successfully read, but the tls is not configured correctly, no https was served
What is the expected behavior?
Should use https protocal
What do you see instead?
no https protocal was being used
Additional information
No response
Have you try removing the node_modules and bun.lockb and try again yet?
Yes
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working