-
Notifications
You must be signed in to change notification settings - Fork 223
Closed
Closed
Copy link
Labels
bugM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documentedM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documentedproject:slack-api-clientproject:slack-api-clientproject:slack-api-client
Milestone
Description
I'm using latest version of the SDK.
When requesting audit logs with any parameters the response is alwyas ok: false. The response doesn't provide warning or error message but does contain requested entries for the audit log.
The Slack SDK version
<dependency>
<groupId>com.slack.api</groupId>
<artifactId>slack-api-client</artifactId>
<version>1.42.1</version>
</dependency>
Java Runtime version
openjdk version "17.0.8"
Steps to reproduce:
- Create AuditClient
- Create logs request with any parameters
- Check if "response.isOk()"
code ran:
public class AuditLogSlackService {
private final Slack slack; // autowired using spring
public List<LogsResponse.Entry> getLogs(String action, Integer latest, Integer oldest, String actor) {
AuditClient auditClient = slack.audit("user-token");
LogsRequest request = LogsRequest.builder()
.token("user-token")
.action(action)
.build();
Optional.ofNullable(latest).ifPresent(request::setLatest);
Optional.ofNullable(oldest).ifPresent(request::setOldest);
Optional.ofNullable(actor).ifPresent(request::setActor);
RetryTemplate retry = RetryServiceUtil.getRetryTemplate(); // retry can be omitted for this example
return retry.execute(arg0 -> {
List<LogsResponse.Entry> result = new ArrayList<>();
do {
try {
LogsResponse response = auditClient.getLogs(request);
if (response.isOk()) {
result.addAll(response.getEntries());
request.setCursor(ofNullable(response.getResponseMetadata()).map(ResponseMetadata::getNextCursor).orElse(""));
} else {
throw new RuntimeException(response.getError());
}
} catch (Exception e) {
log.info("{} Failed with {}", "LogsRequest", e.toString());
throw new RuntimeException(e.getMessage());
}
log.info("Retry finished for " + "LogsRequest");
} while (!request.getCursor().isEmpty());
return result;
});
}
}
Code contains custom exceptions and logging, which can be ignored since they do not result in the error
Expected result:
Response is ok: true and contains entries of the requested audit logs.
Actual result:
Response is ok: false and contains entries of the requested audit logs.
LogsResponse(rawBody=null, ok=false, warning=null, error=null, needed=null, provided=null, responseMetadata=ResponseMetadata(nextCursor=, messages=null, warnings=null), entries=[LogsResponse.Entry(all_entries_here....)])
Metadata
Metadata
Assignees
Labels
bugM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documentedM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documentedproject:slack-api-clientproject:slack-api-clientproject:slack-api-client