Skip to content

08-29-2025 Release (Enable CORS for preflight request)#97

Merged
ezhangy merged 12 commits intomainfrom
dev
Aug 29, 2025
Merged

08-29-2025 Release (Enable CORS for preflight request)#97
ezhangy merged 12 commits intomainfrom
dev

Conversation

@ezhangy
Copy link
Copy Markdown
Contributor

@ezhangy ezhangy commented Aug 29, 2025

Merges the following PR to main:

renovate bot and others added 12 commits August 26, 2025 01:25
### Description

This ticket adds the `Access-Control-Allow-Origin` and
`Access-Control-Allow-Headers` to the Feedback API's preflight requests.
This resolves the CORS issue that caused an outage on 2025-08-26 (see
[outage
doc](https://docs.google.com/document/d/1-8EyzvyVEpYxSif-pfJ0rft4E-yI9-PBpPu-18R44wA/edit?tab=t.0#heading=h.ks8pez39zxhe)).

Additionally, adds units tests for the rating/comment/email Lambda
handlers to check that CORS headers are being included in the response.

### Testing strategy
#### Unit tests
1. `npm install`
2. `npm run test`

##### Steps to test
Test the dev API deployment in the browser by running the front-end
feedback widget component locally and redirecting its API requests to
the dev API Gateway URL:

1. Clone the
[feedback-widget](https://github.com/newjersey/feedback-widget) repo.
2. Update the [`API_URL` in
feedback-widget.js](https://github.com/newjersey/feedback-widget/blob/52d7f6d10518ed721b232112421d46a1deb18593/feedback-widget.js#L64)
to the dev API Gateway URL.
- To find the URL in the AWS Console, first make sure you're logged into
the Innov-Platform-Dev account! Then search "API Gateway" -> click
"Feedback API" in the list of APIs -> click "Stages" in the sidebar ->
"Invoke URL" under "Stage details"
3. Open the `feedback-widget.html` in the browser — you should see a
page containing just the frontend feedback widget component. Test that
submiting a rating/comment/email works (use the network tab to ensure
requests are being sent to the dev API URL and are returning a success
response).

**Note: Submitting feedback via the widget will write to the production
feedback Google Sheet.** Please delete them from the sheet after testing
if you have access, or ask a Platforms engineer to do so for you.

### Additional resources
- ["Enabling CORS for a non-simple request" (AWS
docs)](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html#apigateway-enable-cors-non-simple).
@ezhangy ezhangy marked this pull request as ready for review August 29, 2025 17:39
@ezhangy ezhangy merged commit f09a155 into main Aug 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant