You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Darwin Mustafa-MacBook-Pro.local 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec 6 19:01:59 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6000 arm64
Description
Problem definiton:
Starting from 2024-10-08, we're getting error com.svix.exceptions.ApiException: Application not found (not_found) 1-2 per day. Svix library retries 5 times automatically and all fails. Then, when our code retries again immediately, it succeeds.
Here's the findings:
We build Svix instance with separate tokens for two different Svix endpoints. And each time when publishing a message a new Svix instance is created. In constructor, there’s a static assignment: Configuration.setDefaultApiClient(apiClient);
public Svix(final String token, final SvixOptions options) {
ApiClient apiClient = new ApiClient();
String[] tokenParts = token.split("\\.");
String region = tokenParts[tokenParts.length - 1];
if (region.equals("us")) {
apiClient.setBasePath("https://api.us.svix.com/");
} else if (region.equals("eu")) {
apiClient.setBasePath("https://api.eu.svix.com/");
} else if (region.equals("in")) {
apiClient.setBasePath("https://api.in.svix.com/");
} else {
apiClient.setBasePath(options.getServerUrl());
}
apiClient.setUserAgent(String.format("svix-libs/%s/java", Svix.VERSION));
HttpBearerAuth httpBearer = (HttpBearerAuth) apiClient.getAuthentication("HTTPBearer");
httpBearer.setBearerToken(token);
Configuration.setDefaultApiClient(apiClient);
application = new Application();
authentication = new Authentication();
endpoint = new Endpoint();
eventType = new EventType();
integration = new Integration();
message = new Message();
messageAttempt = new MessageAttempt();
statistics = new Statistics();
}
This api client is being used in MessageApi constructor:
public MessageApi() {
this(Configuration.getDefaultApiClient());
}
When processing messages in parallel, it’s possible that message api takes wrong apiClient because it’s set to a different one by other threads.
That’s why, fixed it by creating svix instances at startup and use those when sending messages.
Is it intended to set and share default apiClient between Svix instances?
The text was updated successfully, but these errors were encountered:
Bug Report
Version
Java library: 1.24.0
Platform
Darwin Mustafa-MacBook-Pro.local 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec 6 19:01:59 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6000 arm64
Description
Problem definiton:
Starting from 2024-10-08, we're getting error
com.svix.exceptions.ApiException: Application not found (not_found)
1-2 per day. Svix library retries 5 times automatically and all fails. Then, when our code retries again immediately, it succeeds.Here's the findings:
We build Svix instance with separate tokens for two different Svix endpoints. And each time when publishing a message a new Svix instance is created. In constructor, there’s a static assignment: Configuration.setDefaultApiClient(apiClient);
This api client is being used in MessageApi constructor:
When processing messages in parallel, it’s possible that message api takes wrong apiClient because it’s set to a different one by other threads.
That’s why, fixed it by creating svix instances at startup and use those when sending messages.
Is it intended to set and share default apiClient between Svix instances?
The text was updated successfully, but these errors were encountered: