Unable to add headers when testing Cloudfront Functions

0

I'm using Cloudfront functions to set up a split url A/B test, one of the steps is to exclude bots as much as possible. In order to do this I'm matching a regex against the User-Agent header to exclude obvious bots (GoogleBot, BingBot etc.) from the test. So far so good.

However, when trying to test my function in the AWS console using the "Test function" functionality, I'm always getting a the error: "Test execution failed: CloudFront encountered an internal error. Please try again.", when adding a header to the test request.

it works fine when testing without headers, cookies can be added just fine as well, it's just when adding a header that the test function breaks. Even the function body itself doesn't seem to matter, as I can reproduce this with the default example function generated by AWS for new functions.

When having the dev tools open in my browser I can see the call to the Cloudfront API returning this response in the background:

<?xml version="1.0"?>

<ErrorResponse xmlns="http://cloudfront.amazonaws.com/doc/2020-05-31/"><Error><Type>Receiver</Type><Code>ServiceUnavailable</Code><Message>CloudFront encountered an internal error. Please try again.</Message></Error><RequestId>9fbf2678-6219-4dbe-8e60-5e4dd84757b4</RequestId></ErrorResponse>

Steps to reproduce:

  1. create new Cloudfront function
  2. create test request with a header (header name and value don't matter)
  3. submit test request
Timon
質問済み 8ヶ月前288ビュー
1回答
1

I was unable to reproduce your issue - please raise this as a case with AWS Support so that they can look into the problem for you.

AWS
エキスパート
Paul_L
回答済み 8ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ