Skip to content

Not Found Image in Static Plugin #1759

@shiqocred

Description

@shiqocred

What version of Elysia is running?

1.4.26

What platform is your computer?

Darwin 25.3.0 arm64 arm

What environment are you using

bun --version 1.3.10

Are you using dynamic mode?

no

What steps can reproduce the bug?

use basic Elysia

new Elysia().use(staticPlugin({ prefix: "/" })).use(cors({ origin: [adminUrl, storeUrl], credentials: true }))

and i can display the image with url but server log return some error

🦊 Elysia is running at localhost:3002
164 |         if (shouldIgnore(pathName)) throw new NotFoundError();
165 |         const cache = fileCache.get(pathName);
166 |         if (cache) return cache.clone();
167 |         try {
168 |           const fileStat = await fs.stat(pathName).catch(() => null);
169 |           if (!fileStat) throw new NotFoundError();
                                     ^
error: NOT_FOUND
 status: 404,
   code: "NOT_FOUND"

      at <anonymous> (/Users/macbookpro/Documents/project/monorepo/sci-master/node_modules/.pnpm/@elysiajs+static@1.4.7_elysia@1.4.22_@sinclair+typebox@0.34.48_exact-mirror@0.2.6_@sinc_894428d145c519d7fe4e3799772fabe9/node_modules/@elysiajs/static/dist/index.mjs:169:32)
      at async handle (file:///Users/macbookpro/Documents/project/monorepo/sci-master/node_modules/.pnpm/elysia@1.4.22_@sinclair+typebox@0.34.48_exact-mirror@0.2.6_@sinclair+typebox@0.34.48__f_22fc0dc8ac9c2b02f26b937f6751f981/node_modules/elysia/dist/bun/index.js:7:37)

and i cannot consume url in my nextjs website that return

http://localhost:3001/_next/image?url=http%3A%2F%2Flocalhost%3A3002%2Fimages%2Fcategories%2Fbyoarfnf072sg4kaadvq1mlw-1772059038043.webp&w=3840&q=75

"url" parameter is not allowed

and Can Elysia write files to the public directory in production, or is it the same as Next.js?

What is the expected behavior?

i expected that no return some error

What do you see instead?

Additional information

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

yes, but no change

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