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

Closed
ghost opened this issue Jul 18, 2024 · 2 comments
Closed

cache-control error #32

ghost opened this issue Jul 18, 2024 · 2 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jul 18, 2024

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 :)

@bogeychan
Copy link
Collaborator

Thanks for reporting this finding!

Can't reproduce it on my end. Can you give it a try with the latest verion?

@bogeychan bogeychan self-assigned this Dec 17, 2024
@bogeychan
Copy link
Collaborator

Closing this due to inactivity

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