Checklist
Description
When subscribing to the Event Streams SSE endpoint via managementApi().events().subscribe(...), every emitted event is deserialized to EventStreamSubscribeEventsResponseContent._UnknownValue with type: null and value: null, regardless of the actual event type. The typed variants (e.g. getUserUpdated(), getOffsetOnly()) are therefore never populated, and _isUnknown() is always true, so consumers have no way to read the event payload.
I've created a PR that shows the bug with an unit-test and a potential fix: #896
Reproduction
Example code to reproduce the bug:
private void connect()
{
final SubscribeEventsRequestParameters.Builder settings = SubscribeEventsRequestParameters.builder()
.eventType(EventStreamSubscribeEventsEventTypeEnum.USER_UPDATED);
final Optional<String> offset = syncService.getOffset(EVENT_TYPE_KEY);
if (offset.isPresent())
{
settings.from(offset.get());
}
else
{
settings.fromTimestamp(startOfDay());
}
log.info("Subscribing to Auth0 user.updated event stream (resuming from {})", offset.map(o -> "offset " + o).orElse("start of day"));
final Iterable<EventStreamSubscribeEventsResponseContent> stream = apiProvider.getManagementApi().events().subscribe(settings.build());
try
{
for (EventStreamSubscribeEventsResponseContent event : stream)
{
try
{
handleEvent(event);
}
catch (Exception e)
{
// A single malformed event must not tear down the whole stream.
log.error("Failed to handle Auth0 event", e);
}
}
}
finally
{
closeQuietly(stream);
}
}
private void handleEvent(EventStreamSubscribeEventsResponseContent event)
{
if (event.getUserUpdated().isPresent())
{
handleUserUpdated(event.getUserUpdated().get());
return;
}
if (event.getOffsetOnly().isPresent())
{
handleOffsetOnly(event.getOffsetOnly().get());
return;
}
if (event._isUnknown())
{
log.warn("Received unknown Auth0 event type, ignoring: {}", event);
}
}
All events will print Received unknown Auth0 event type, ignoring: EventStreamSubscribeEventsResponseContent{type: null, value: null}
(Trigger update-events by updating users in Auth0)
I've also created a unit test that reproduces the bug.
https://github.com/auth0/auth0-java/pull/896/changes#diff-7bcc14b70df7dcbb2aeae35c7e142483c5d1cf4117239559729c1a41b312139d
Additional context
No response
auth0-java version
3.10.0
Java version
21
Checklist
Description
When subscribing to the Event Streams SSE endpoint via
managementApi().events().subscribe(...), every emitted event is deserialized toEventStreamSubscribeEventsResponseContent._UnknownValuewithtype: nullandvalue: null, regardless of the actual event type. The typed variants (e.g.getUserUpdated(),getOffsetOnly()) are therefore never populated, and_isUnknown()is alwaystrue, so consumers have no way to read the event payload.I've created a PR that shows the bug with an unit-test and a potential fix: #896
Reproduction
Example code to reproduce the bug:
All events will print
Received unknown Auth0 event type, ignoring: EventStreamSubscribeEventsResponseContent{type: null, value: null}(Trigger update-events by updating users in Auth0)
I've also created a unit test that reproduces the bug.
https://github.com/auth0/auth0-java/pull/896/changes#diff-7bcc14b70df7dcbb2aeae35c7e142483c5d1cf4117239559729c1a41b312139d
Additional context
No response
auth0-java version
3.10.0
Java version
21