-
-
Notifications
You must be signed in to change notification settings - Fork 268
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
mapResponse not found in module #979
Comments
After a deep investigation in my code "elysia-compression" plugin causes this issue. I have replaced the package with "elysia-compress" same issue occurs |
Seems like plugin doesn't have been updated to 1.2 yet. You can either:
{
"override": {
"elysia": "1.2.6"
}
} Ultimately, should be solved once the plugin has been updated to 1.2 |
It seems resolving this issue takes some time. Here is a temporary workaround that was good enough for us: export const compression = new Elysia({ name: 'compressResponses' })
.mapResponse(({ request, response, set }) => {
const isJson = typeof response === 'object'
const compressionRequested = request.headers.get('Accept-Encoding')?.includes('gzip')
const text = isJson ? JSON.stringify(response) : (response?.toString() ?? '')
// Only compress if content is larger than 2KB and compression is requested
if (!compressionRequested || text.length < 2048) {
return response as Response
}
set.headers['Content-Encoding'] = 'gzip'
return new Response(Bun.gzipSync(new TextEncoder().encode(text)), {
headers: {
'Content-Type': `${isJson ? 'application/json' : 'text/plain'}; charset=utf-8`,
},
})
})
.as('plugin') It's based on this example but works with swagger plugin and has a sensible minimal threshold (2kb) This has no configuration options and it only supports gzip. If you need to actually also compress blobs see this gist. but i skipped it here for brevity Usage, very similar to elysia-compress: const app = new Elysia()
.use(compression)
.get('/', () => ({ hello: 'world' })) Since it uses blocking |
What version of Elysia is running?
1.2.6
What platform is your computer?
Microsoft Windows NT 10.0.22635.0 x64
What steps can reproduce the bug?
After upgrading elysis version 1.2.6 i got mapResponse not found in module. I have removed bun.locknb file and node_modules file and installed again. Nothing works
What is the expected behavior?
bun run dev: should start elysia server
What do you see instead?
Additional information
No response
Have you try removing the
node_modules
andbun.lockb
and try again yet?I have tried
The text was updated successfully, but these errors were encountered: