Event Streams SSE subscription always deserializes events to `_UnknownValue`
まだ誰も着手していません。
評価
調査の方向性
managementApi().events().subscribe(...) から始め、リンクされた pull request #896 のユニットテストと修正案を確認してください。発行されたイベントが、常に _UnknownValue になるのではなく、getUserUpdated() や getOffsetOnly() などの型付きバリアントに値を設定することを確認し、SSE レスポンス処理に対して回帰テストを実行してください。
索引モデルが issue の本文から書いたものです。
説明
Checklist
- I have looked into the Readme and Examples, and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
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: https://github.com/auth0/auth0-java/pull/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
- 主要言語
- Java
- スター
- 319
- フォーク
- 155
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 12
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
auth0/auth0-java のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
auth0/auth0-java#887 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
auth0/auth0-java#842 · コメント 2 件 ·
-
bug
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
auth0/auth0-java#911 ·
-
feature request
難易度 1/5 1時間未満 初心者へのやさしさ 50/100
auth0/auth0-java#754 · コメント 2 件 ·
auth0/auth0-java の issue をすべて見る
似ている issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
1.0.0-alpha2 Type/Improvement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
wso2/dpdp-accelerator#272 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
infinispan/infinispan#18150 ·
-
area/frontend
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100