Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache-control error #32

Open
jvanveen opened this issue Jul 18, 2024 · 0 comments
Open

cache-control error #32

jvanveen opened this issue Jul 18, 2024 · 0 comments

Comments

@jvanveen
Copy link

Hi!

Thank you for creating Elysiajs & this static plugin!
I'm trying out Elysiajs with Bun (1.1.20) to see if I can setup a basic static file server + API.
However, using Elysia 1.1.3 and @elysiajs/static 1.1.0, I get the following error back in the browser
when trying to access a file from my public dir:

{"name":"TypeError","message":"undefined is not an object (evaluating 'headers[\"cache-control\"]')"}

It seems the Response object doesn't produce any headers. The relevant code:

export const app = new Elysia().use(staticPlugin({
    assets: 'public',
    alwaysStatic: true,
    indexHTML: true, 
    headers: {},
})).listen(3030)

When I disable the cache, the error is gone:

export const app = new Elysia().use(staticPlugin({
    assets: 'public',
    alwaysStatic: true,
    indexHTML: true, 
    headers: {},
    noCache: true,  
})).listen(3030)

I'm not sure if this is a Bun related issue, or whether its something else, so I thought I post it here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant