File tree Expand file tree Collapse file tree
plugins/nf-amazon/src/main/nextflow/cloud/aws Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -270,7 +270,23 @@ class AwsClientFactory {
270270
271271 return builder. build()
272272 }
273-
273+ /**
274+ * Returns an AwsCredentialsProvider for S3 clients.
275+ *
276+ * This method wraps the same AWS credentials used for other clients, but ensures proper handling of anonymous S3 access.
277+ * If the 'anonymous' flag is set in Nextflow's AWS S3 configuration, or if no credentials are resolved by other providers,
278+ * an AnonymousCredentialsProvider instance is returned.
279+ *
280+ * Prior to AWS SDK v2, the S3CredentialsProvider automatically managed fallback to anonymous access when no credentials were found.
281+ * However, due to a limitation in the AWS SDK v2 CRT Async S3 client (see https://github.com/aws/aws-sdk-java-v2/issues/5810),
282+ * anonymous credentials only work when explicitly configured via AnonymousCredentialsProvider.
283+ * Custom credential providers or provider chains that resolve to anonymous credentials are not handled correctly by the CRT client.
284+ *
285+ * To work around this, this method explicitly checks whether credentials can be resolved.
286+ * If no credentials are found, it returns an AnonymousCredentialsProvider; otherwise, it returns the resolved provider.
287+ *
288+ * @return an AwsCredentialsProvider instance, falling back to anonymous if needed.
289+ */
274290 private AwsCredentialsProvider getS3CredentialsProvider () {
275291 if ( config. s3Config. anonymous )
276292 return AnonymousCredentialsProvider . create()
You can’t perform that action at this time.
0 commit comments