aws / amazon-chime-sdk-js

A JavaScript client library for integrating multi-party communications powered by the Amazon Chime service.
Apache License 2.0
709 stars 477 forks source link

Cannot query nearest media region for a specific IP #2733

Open kelvin2200 opened 1 year ago

kelvin2200 commented 1 year ago

What happened and what did you expect to happen?

As stated in the docs, a simple GET to https://nearest-media-region.l.chime.aws will return the nearest media region where you should create your meeting, but there are cases where that request cannot be made client-sided.

...and there is no query param that can be provided (at least not that I know of) to do smth like https://nearest-media-region.l.chime.aws/?ip=0.0.0.0

For situations where this request cannot be made client-sided, the backend would handle it, but it would need to pass the client's IP to the aws endpoint.

Is there any possible way to do that?

Have you reviewed our existing documentation?

Reproduction steps

none needed

Amazon Chime SDK for JavaScript version

latest

What browsers are you seeing the problem on?

All

Browser version

all

Meeting and Attendee ID Information.

No response

Browser console logs

none needed

hensmi-amazon commented 1 year ago

The service behind https://nearest-media-region.l.chime.aws is dynamically determining the closes region using AWS infrastructure. It is not doing IP lookups, hence it is not possible to find the closest location knowing simply the IP of a client, unfortunately.

You could utilize something like MaxMind for IP lookup, but it is not something that the Chime SDK will provide for a service. I'm curious, could you expand on why https://nearest-media-region.l.chime.aws cannot be called by a client?

kelvin2200 commented 1 year ago

There are scheduling scenarios, where one attendee with (certain) privileges creates a meeting setup and the meeting itself is started automatically at a later point in time on a different region, either because the user's region changed or because it is started by a user in another region... It turns into scenarios where all potential attendees have to make that client request because it is hard to determine which one actually creates/starts the chime meeting. It would be much easier to make that determination on the backend, plus we would only make a single request to the nearest media region api.

This is mostly a consequence of rate-limits applied on the createMeeting endpoint and the fact the meeting expires after 5 min of inactivity, meaning we cannot create the actual Chime meeting ahead of time.

kelvin2200 commented 1 year ago

@hensmi-amazon thank you for your response. Question: Is there a chance to run into some sort of rate-limit on that endpoint? Because we have to make a lot of requests to it

hensmi-amazon commented 1 year ago

It is not likely to be rate limited as the requests would be spread out across end-users.

Thanks for the explanation, I understand that the need to pick a central region and the timing required to create meetings is a bit clunky; unfortunately I do not think there is currently any ongoing improvements for the time being in that department. I will keep this issue open as a feature request for improvements to the ease of picking meeting regions.

kelvin2200 commented 1 year ago

Thank you for the insight, I will keep track of this

kelvin2200 commented 1 year ago

@hensmi-amazon I'm back with a slightly different problem. I don't know if this is the proper place to file it, or if I should open a different issue.

It turns out that requests to the nearest media region endpoint from certain IP's return an undefined region.

One such case we've discovered are requests made from Mauritius.

Having the possibility to pass an IP param in this case would also aid in troubleshooting.

This was particularly hard to find out given we weren't looking for it...