serverless / serverless/serverless

Full documentation missing from CloudFront event type

Open
#6,785 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat/aws-event-cloudfront documentation help wanted needs feedback
Dominant language
JavaScript
Stars
46.9k
Forks
5.7k
Avg merge
10h 7m
Merged PRs (30d)
57

Description

Bug Report

Description

The documentation for cloudfront is very thin (https://serverless.com/framework/docs/providers/aws/events/cloudfront/). There's a few examples, but there's no complete documentation of all supported params. Since its likely that users have to use a Resources object to describe the Cloudfront distribution in detail, this event type is potentially quite complex to get right. It would be good of the documentation was a bit richer.

For example, there's no mention of the fact that CustomOriginConfig is a required field if using non-s3 origins.

As an example: I notice that in code, the QueryString attribute is hard-coded to false (https://github.com/serverless/serverless/blob/c0ec32b4e0f2e3dacce12a614db92dfba6e526a6/lib/plugins/aws/package/compile/events/cloudFront/index.js#L181), which means that I probably have to "overwrite" the entire origin attribute. I'm suspecting this is quite common for uses-cases where cloudfront/lambda@edge is involved so it would be good if that was documented.
In short: Make it as easy as possible to get cloudfront/lambda@edge right using serverless - also for non-trivial/real-life apps.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CloudFront documentation page and the AWS CloudFront compiler at lib/plugins/aws/package/compile/events/cloudFront/index.js, especially the QueryString handling. Compare the supported event parameters with the current examples, then document non-S3 CustomOriginConfig requirements and how origin settings are overridden for CloudFront and Lambda@Edge use cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.