DianaIonita / serverless-api-gateway-caching

A plugin for the Serverless framework which helps with configuring caching for API Gateway endpoints.
ISC License
136 stars 35 forks source link

Support Chinese characters in cacheKeyParameters #130

Open Dan-Wood opened 11 months ago

Dan-Wood commented 11 months ago

In our web app we send down a query which is just a string from the front end to our API's if we include Chinese characters in that string the API fails with a 500 straight away. We don't see any logs on CloudWatch either.

If we remove the cache key, it works perfectly fine.

Use any Chinese character, here's one that it was failing on and another 产业链

 cacheKeyParameters:
                          - name: integration.request.header.query
                            mappedFrom: method.request.body.query

Just wanted to note that I had a look around and can't see anyone else complaining of this issue...

DianaIonita commented 11 months ago

Hi @Dan-Wood,

Thanks for raising the issue. Have you tried enabling API Gateway execution logs? They're very detailed logs about what happens before a request even reaches your lambda. Here's what AWS says about them and how to set them up.

The plugin itself doesn't do anything with cache key parameters aside from passing them along to AWS via API calls or CloudFormation tweaks.

lBroth commented 10 months ago

I have the same issue, I'll try to check the logs

lBroth commented 10 months ago

In our web app we send down a query which is just a string from the front end to our API's if we include Chinese characters in that string the API fails with a 500 straight away. We don't see any logs on CloudWatch either.

If we remove the cache key, it works perfectly fine.

Use any Chinese character, here's one that it was failing on and another 产业链


 cacheKeyParameters:

                          - name: integration.request.header.query

                            mappedFrom: method.request.body.query

Just wanted to note that I had a look around and can't see anyone else complaining of this issue...

Do you have any update or workaround?

Dan-Wood commented 10 months ago

Do you have any update or workaround?

Sorry, haven't had a chance to look into the logs.

Our solution was to just MD5 the string as a separate mapping and cache on that for now.