Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: remove $context.status from websocket access log format #7014

Merged
merged 1 commit into from Nov 27, 2019

Conversation

sammarks
Copy link
Contributor

What did you implement

It looks like AWS may have recently introduced a change where $context.status is invalid on API Gateway WebSocket APIs (or at least now they're enforcing invalid tokens).

The following context variables are not supported: [$context.status] (Service: AmazonApiGatewayV2; Status Code: 400; Error Code: BadRequestException; Request ID: a37f886a-d719-485d-9593-fe2b14182df7)

This change simply removes the offending token from the WebSocket log format so WebSocket APIs will deploy properly.

How can we verify it

Create a WebSocket-based service.

service: websocket-test
provider:
  logs:
    websocket: true
functions:
  websocket:
    handler: src/websocket
    events:
      - websocket: $default

Todos

Useful Scripts
  • npm run test-ci --> Run all validation checks on proposed changes
  • npm run lint-updated --> Lint all the updated files
  • npm run lint:fix --> Automatically fix lint problems (if possible)
  • npm run prettier-check-updated --> Check if updated files adhere to Prettier config
  • npm run prettify-updated --> Prettify all the updated files
  • Write and run all tests
  • Write documentation
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@codecov-io
Copy link

Codecov Report

Merging #7014 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7014   +/-   ##
=======================================
  Coverage   88.48%   88.48%           
=======================================
  Files         229      229           
  Lines        8416     8416           
=======================================
  Hits         7447     7447           
  Misses        969      969
Impacted Files Coverage Δ
...aws/package/compile/events/websockets/lib/stage.js 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d0c6c8d...d1537f7. Read the comment docs.

@medikoo medikoo added the bug label Nov 27, 2019
@medikoo medikoo added this to the 1.59.0 milestone Nov 27, 2019
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sammarks !

@leclercb
Copy link

leclercb commented Dec 2, 2019

Is there any workaround in the meantime ?
This bug is currently preventing any deployment of application using websockets.
I tried with websocket logs to false, the problem is the same.
Thanks

@sammarks
Copy link
Contributor Author

sammarks commented Dec 2, 2019

@leclercb I’ve just updated my package.json to point to my fork directly until we get a new release with the fix included. Or since it’s merged into master now you can just update yours to point to the master branch instead of a specific version.

@pmuens pmuens changed the title fix: remove $context.status from websocket access log format Fix: remove $context.status from websocket access log format Dec 2, 2019
@Gr8z
Copy link

Gr8z commented Dec 3, 2019

Is this gonna be released soon? This this blocking all deployments, and since we use Github Actions, we can't change the package.json

@henhal
Copy link

henhal commented Dec 3, 2019

Gah, found this only now. This fixes #7038. When will this be released?

@Gr8z For a temp workaround look at #7038 !

@medikoo
Copy link
Contributor

medikoo commented Dec 3, 2019

Sorry for delay. It'll be released first thing tomorrow CET morning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants