33 questions
1
vote
1
answer
69
views
Getting "ReadableStream has already been used" when POST request and using clerkPlugin()
Below is the error I console from my client side.
{
"data": null,
"error": {
"message": "ReadableStream has already been used"
},
"headers"...
1
vote
0
answers
65
views
TypeScript throwing error: 2339 - Property user doesn't exist on type
user.routes.ts:
import { Elysia } from "elysia";
import { authMiddleware } from "../middleware/isAuthenticated";
export const usersRoutes = new Elysia({ prefix: "/users" ...
1
vote
0
answers
190
views
octet-stream memory leaking when using Bun and Elysia
So a few weeks ago, I ported my app that uses NodeJS to Bun (and also moved from Express to Elysia). However, it seems that it's heavily memory leaking when there is a lot of traffic going on.
memory ...
1
vote
1
answer
376
views
Issues with Defining a Recursive Schema in Elysia
I'm currently working on a project using Elysia, and I'm trying to define a recursive schema for product variants. My goal is to allow each variant to have children, which can also be variants ...
-1
votes
1
answer
1k
views
Uploading files using Elysiajs and save it to mongodb
I'm new to elysiajs and trying to upload files using multer and elysia, but its not working for me
i tried to add a beforehandle and afterhandle but it's still not working ,
..............................
0
votes
1
answer
62
views
How to save type of an object
I have backend and frontend projects. I want to copy backend types to frontend.
On backend I have
const app = SomeFunctionThatGeneratesSomething();
export type App = typeof app;
I want to save App to ...
2
votes
1
answer
242
views
Twilio client does not resolve when using with bun
I have a verification check function
async verifyWithOTP(phone: string, otp: string) {
console.log({ phone, otp });
try {
console.log("awaiting verification");
...
3
votes
1
answer
713
views
How to create multiple custom error messages using Elysia's Typebox?
I want to create a schema with Elysia's Typebox so that a different error message appears for each check.
I want to do something similar to what Joi does.
Joi:
import joi from 'joi';
export const ...
3
votes
2
answers
4k
views
Using Bun+Elysia+socket.io together
I'm trying to build a web backend for a chat app using the runtime Bun, the library Elysia to write a REST API and the library socket.io to deliver the messages in realtime.
I went through the ...
0
votes
2
answers
2k
views
How to fetch from a different origin and include cookies in the request
The problem is that i went to fetch cookies from my backend thats on a different origin than my front end. And i cant get cors to work with me. I am using bun with elysia.
This is an example i made to ...
2
votes
0
answers
806
views
Error when importing a local package made with Bun
I've created a package with Bun and mongoose in TS, to import that package I've followed the suggested configuration from "Crafting a Typescript NPM package with Bun - Function Agents", ...
1
vote
1
answer
2k
views
How do I set the POST response body in Bun and Elysia?
I am trying to change the response body to a POST route in Elysia, but it appears that CTX only has the request and I can't find anything on modifying the response. My use case is I want to give the ...
1
vote
1
answer
2k
views
Prisma InvalidDatasourceError: Error validating datasource db: the URL must start with the protocol prisma://
Question:
I'm encountering an issue with Prisma where I get the error message "InvalidDatasourceError: Error validating datasource db: the URL must start with the protocol prisma://" when ...
3
votes
1
answer
6k
views
ElysiaJS and request body typescript definitions
I'm having difficulty with type definitions on my Bun server using ElysiaJS, specifically with the body property within the handler function. I've created two models, a User and a Character model, and ...
1
vote
0
answers
726
views
Is there a way to adjust routing based on headers in Elysia?
I'm attempting to change my routing based on header values.
For example, if an incoming request contains an accept header of application/json, I want to call one set of routes to return JSON data, but ...
3
votes
1
answer
786
views
How to get request ip in ElysiaJs?
I'm trying to find something like this
router.get('/', async (ctx, next) => {
const clientIP = ctx.request.ip;
ctx.body = `Hello World ${clientIP}`;
})
app.onRequest((context) => {
const ...
1
vote
4
answers
4k
views
How to distinguish response validation error from other validation errors in Elysia.js
I would like to validate response of request in silent (for example only log to console) because I don't want to interrupt user with this information (also response schema is used in elysiajs swagger ...