iflytek/astron-agent · error · BusinessException
S3_PRESIGN_ERROR
S3_PRESIGN_ERROR
Error message
S3_PRESIGN_ERROR
What it means
S3_PRESIGN_ERROR is thrown by S3Util.generatePresignedPutUrl(objectKey, expirySeconds) when MinIO's getPresignedObjectUrl fails. Presigning requires a correctly signed request against the configured credentials and endpoint; any signing, crypto, IO, or server error is converted into this BusinessException. Note: this method is deprecated in favor of S3ClientUtil.generatePresignedPutUrl().
Solutions
- Enable/inspect the 'S3 presign error' debug log for the underlying exception
- Verify s3.accessKey and s3.secretKey are set and valid (InvalidKeyException usually means bad/empty credentials)
- Ensure s3.bucket is configured and the bucket exists
- Pass an expirySeconds within 1-604800, or rely on the s3.presignExpirySeconds default
- Migrate to the non-deprecated com.iflytek.astron.console.commons.util.S3ClientUtil.generatePresignedPutUrl()
- Check network/DNS reachability of s3.endpoint and host clock sync
Example fix
// before
return minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
.method(Method.PUT).bucket(bucketName).object(objectKey).expiry(exp).build());
// after
int safeExp = Math.min(Math.max(exp, 1), 604800);
return minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
.method(Method.PUT).bucket(bucketName).object(objectKey).expiry(safeExp).build()); Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check credentials and expiry bounds before presigning
if (isBlank(accessKey) || isBlank(secretKey)) throw new IllegalStateException("s3 accessKey/secretKey not configured");
if (isBlank(bucketName)) throw new IllegalStateException("s3.bucket not configured");
int exp = (expirySeconds != null && expirySeconds > 0) ? expirySeconds : 600;
if (exp < 1 || exp > 604800) throw new IllegalArgumentException("expiry must be 1..604800 seconds"); Try / catch
try {
String url = s3Util.generatePresignedPutUrl(objectKey, expirySeconds);
} catch (BusinessException e) {
log.error("presign failed; check 'S3 presign error' debug log and credentials", e);
throw e; // or fall back to a server-mediated upload endpoint
} Prevention
- Ensure s3.accessKey/s3.secretKey are present and valid before presigning
- Keep expiry within the S3 limit of 1 to 604800 seconds
- Verify s3.endpoint reachability and clock synchronization (signature validity)
- Migrate to the supported S3ClientUtil.generatePresignedPutUrl() since this method is deprecated forRemoval
When it happens
Trigger: minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs PUT with bucket, objectKey, expiry) throws one of the caught exceptions: ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException, ServerException.
Common situations: Missing or invalid s3.accessKey/s3.secretKey (InvalidKeyException from HMAC signing); unreachable s3.endpoint; expiry value out of the S3-allowed range (1s-604800s); empty s3.bucket so the presign targets a non-existent bucket; clock skew invalidating signatures.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/76a5147b253b0fdc.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/util/S3Util.java:374
int exp = (expirySeconds != null && expirySeconds > 0) ? expirySeconds : presignExpirySeconds;
return minioClient.getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder()
.method(Method.PUT)
.bucket(bucketName)
.object(objectKey)
.expiry(exp)
.build());
} catch (ErrorResponseException
| InsufficientDataException
| InternalException
| InvalidKeyException
| InvalidResponseException
| IOException
| NoSuchAlgorithmException
| XmlParserException
| ServerException e) {
log.debug("S3 presign error:", e);
throw new BusinessException(ResponseEnum.S3_PRESIGN_ERROR);
}
}
}
View on GitHub (pinned to 5e758547a8)