Amazon Q Connect unable to make API calls when embedded
- Dominant language
- JavaScript
- Stars
- 14
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
When Amazon Q Connect is embedded within an iframe the library is unable to make API calls due to a bug in `communicationProxy.ts` in the `subscribeToChannel` function.
This line of code tries to check if the event's source.location is not equal to either the window.parent.location or the window.top.location.
`if ((e.source as Window)?.location !== ((window.top || window.parent).location)) return;
`
If it isn't then it exits the function and does not continue to make the API call. The issue is that window.top will never be null so the expression `(window.top || window.parent).location` will always evaluate to `window.top.location`. When Amazon Q Connect is embedded e.source.location will never equal window.top.location so the function will always exit early.
A proposed solution would be to individually check e.source.location against both window.top.location and window.parent.location
Contributor guide
Research direction
Start in communicationProxy.ts at the subscribeToChannel function and inspect how the event source is compared with window.top and window.parent. Reproduce the embedded Amazon Q Connect case, then verify that API calls continue for the valid parent source while unrelated event sources are still rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100