4
Views
1
Comments
[SSE Reactive Client] MSFTFetchEventSource ConnectionOpened event is triggered even on error
sse-reactive-client
Reactive icon
Forge asset by Nuno Damaso
Application Type
Reactive

I implemented an custom authorisation on the Rest subscribe endpoint, which throws an exception if no valid key is passed. This works fine in a happy flow, but I ran across the issue that when the auth key is invalid and the exception is thrown, the component still triggers the ConnectionOpened event, even though the connection is not open. This causes no messages to be passed. The TokenReceived event is not triggered.

I checked in the JavaScript source, and found that the connection request is not validated (MsftFetchEventSource.js line 58)

If the response is validated, the events do work as expected.


Can be reproduced by setting the authentication method on the Subscribe endpoint to custom, and throwing an exception there.

2024-09-08 11-13-40
Nuno Damaso
 
MVP

Hi Roel Janssen,

Thanks for the detailed share. I will release a patch soon with a guard to validate the existence of the response object.


Thanks,


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.