fastify / fastify-compress

Fastify compression utils

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Fastify-compress] Not working with aws api gateway proxy+

thanhlq opened this issue · comments

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.0.0

Plugin version

6.0.0

Node.js version

16.x

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

lambda

Description

When I register this pluggin I got no response data in browser (disable the plugin, it works).

I got this error report ERR_CONTENT_DECODING_FAILED.
(In firefix, the message says: Content Encoding Error).

Steps to Reproduce

  • Simple aws api gateway deploy with proxy++

lambda.js

import awsLambdaFastify from '@fastify/aws-lambda';
import app from './main.js';

const proxy = awsLambdaFastify(app)
const handler = (event, context, callback) => {
  context.callbackWaitsForEmptyEventLoop = false;
  return proxy(event, context, callback)
};

export {
  handler
}

app.js ("@fastify/compress": "^6.0.0",)

import mCompress from '@fastify/rate-limit'
 fastify.register(mCompress, {
     global: true,
     encodings: ['gzip', 'deflate']
 })

(Even I removed encodings, still not working).
(I run in localhost wihout any problems)

Expected Behavior

No response

Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.

You are importing mCompress from fastify-rate-limit and not from fastify-compress? Is this even correct?