serverless-api-gateway-caching icon indicating copy to clipboard operation
serverless-api-gateway-caching copied to clipboard

Support Chinese characters in cacheKeyParameters

Open Dan-Wood opened this issue 2 years ago • 4 comments

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...

Dan-Wood avatar Jul 24 '23 05:07 Dan-Wood

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.

DianaIonita avatar Aug 02 '23 19:08 DianaIonita

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

lBroth avatar Sep 04 '23 12:09 lBroth

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?

lBroth avatar Sep 04 '23 12:09 lBroth

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.

Dan-Wood avatar Sep 05 '23 01:09 Dan-Wood