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

WebsocketEvent::getRegion is incompatible with custom domain names. #1593

Closed
Shkeats opened this issue Jul 14, 2023 · 2 comments · Fixed by #1594
Closed

WebsocketEvent::getRegion is incompatible with custom domain names. #1593

Shkeats opened this issue Jul 14, 2023 · 2 comments · Fixed by #1594
Labels

Comments

@Shkeats
Copy link
Contributor

Shkeats commented Jul 14, 2023

Description:

Bref\Event\ApiGateway\WebsocketEvent has a method getRegion() that should return the current AWS region e.g. eu-west-1

This is implemented by parsing it out of the domainName from the event requestContext.

This makes sense only in the case that default AWS provided API gateway domains are used. When you set up your own domain for the websocket API you end up getting a segment of that domain returned as your region.

For example if you have a domain configured of websocket.example.org the AWS region returned by this method would be org which isn't correct.

Hope that makes sense, it's a fairly straightforward one but happy to provide more context if needed. I'm not sure if it's a good solution but the current region is available in Lambda via an environment variable.

The below resolves it for me:

image
@Shkeats
Copy link
Contributor Author

Shkeats commented Jul 14, 2023

PR added with this change #1594

@mnapoli
Copy link
Member

mnapoli commented Jul 15, 2023

Thanks for the PR!

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

Successfully merging a pull request may close this issue.

2 participants