Unhandled error event: Error: connect ETIMEDOUT - google-cloud-platform

Encountering ioredis connection timeout when using cloud function in console
Error message below
Unhandled error event: Error: connect ETIMEDOUT
at TLSSocket.\<anonymous\> (/workspace/node_modules/ioredis/built/Redis.js:168:41)
at Object.onceWrapper (node:events:627:28)
at TLSSocket.emit (node:events:513:28)
at TLSSocket.emit (node:domain:552:15)
at TLSSocket.Socket.\_onTimeout (node:net:550:8)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
the part of my code for connecting to redis instance is as below
const REDISHOST = process.env.REDISHOST;
const REDISPORT = process.env.REDISPORT;
const REDISAUTH = process.env.AUTHSTRING;
const REDISKEY = process.env.REDISKEY;
const client = redis.createClient({
host: REDISHOST,
port: REDISPORT,
password: REDISAUTH,
tls: {
ca: REDISKEY
}
Any help would be appreciated

Related

From remote machine getting connection refused for GCP Bigquery

I am running a sample code from google to get a simple select query. Which is working fine in my local but from my k8s environment I am getting the below error
Exception in thread "main" com.google.cloud.bigquery.BigQueryException: Error getting access token for service account: connect timed out
at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.translate(HttpBigQueryRpc.java:115)
at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.create(HttpBigQueryRpc.java:220)
at com.google.cloud.bigquery.BigQueryImpl$5.call(BigQueryImpl.java:369)
at com.google.cloud.bigquery.BigQueryImpl$5.call(BigQueryImpl.java:366)
at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:105)
at com.google.cloud.RetryHelper.run(RetryHelper.java:76)
at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:50)
at com.google.cloud.bigquery.BigQueryImpl.create(BigQueryImpl.java:365)
at com.google.cloud.bigquery.BigQueryImpl.create(BigQueryImpl.java:340)
at com.rakuten.dps.dataplatform.ingest.utility.BQ_test.main(BQ_test.java:67)
Caused by: java.io.IOException: Error getting access token for service account: connect timed out
at com.google.auth.oauth2.ServiceAccountCredentials.refreshAccessToken(ServiceAccountCredentials.java:444)
at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:157)
at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:145)
at com.google.auth.oauth2.ServiceAccountCredentials.getRequestMetadata(ServiceAccountCredentials.java:603)
at com.google.auth.http.HttpCredentialsAdapter.initialize(HttpCredentialsAdapter.java:91)
at com.google.cloud.http.HttpTransportOptions$1.initialize(HttpTransportOptions.java:159)
at com.google.api.client.http.HttpRequestFactory.buildRequest(HttpRequestFactory.java:88)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:422)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:541)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:474)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:591)
at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.create(HttpBigQueryRpc.java:218)
... 8 more
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:607)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:284)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1340)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1315)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:264)
at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:113)
at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:84)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1012)
at com.google.auth.oauth2.ServiceAccountCredentials.refreshAccessToken(ServiceAccountCredentials.java:441)
... 19 more
Below is the sample Code:
public class BQ_test {
private static final Logger logger = LoggerFactory.getLogger(BQ_test.class);
public static void main(String[] args) {
Job queryJob = null;
String actualValue = "";
NetHttpTransport transport = new NetHttpTransport();
JsonFactory jsonFactory = new JacksonFactory();
String query = "SELECT * FROM `iconic-parsec-315409.bookmark_BQ.sbm_item_tbl``";
String projectId = "iconic-parsec-315409";
File credentialsPath = new File("/tmp/iconic-parsec-315409-823ef1c38a9d.json");
GoogleCredentials credentials;
try {
FileInputStream serviceAccountStream = new FileInputStream(credentialsPath);
credentials = ServiceAccountCredentials.fromStream(serviceAccountStream);
if (credentials.createScopedRequired()) {
Collection<String> bigqueryScopes = BigqueryScopes.all();
credentials = credentials.createScoped(bigqueryScopes);
}
BigQuery bigquery = BigQueryOptions
.newBuilder()
.setCredentials(credentials)
.setProjectId(projectId)
.build()
.getService();
QueryJobConfiguration queryConfig =
QueryJobConfiguration.newBuilder(query)
.setUseLegacySql(false)
.setJobTimeoutMs(180000L)
.build();
// Create a job ID so that we can safely retry.
JobId jobId = JobId.of(UUID.randomUUID().toString());
queryJob = bigquery.create(JobInfo.newBuilder(queryConfig).setJobId(jobId).build());
// Wait for the query to complete.
queryJob = queryJob.waitFor();
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
// Check for errors
if (queryJob == null) {
throw new RuntimeException("Job no longer exists");
} else if (queryJob.getStatus().getError() != null) {
// You can also look at queryJob.getStatus().getExecutionErrors() for all
// errors, not just the latest one.
throw new RuntimeException(queryJob.getStatus().getError().toString());
}
// Get the results.
TableResult result = null;
try {
result = queryJob.getQueryResults();
// Print all pages of the results.
// writeFvLToOrcFile(result,"/Users/susanta.a.adhikary/Downloads/test.orc");
for (FieldValueList row : result.iterateAll()) {
// String type
actualValue = row.get("sbm_item_id").getStringValue();
System.out.println(actualValue);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
I tried curl -I "https://oauth2.googleapis.com/token" from my remote k8s pod and getting
HTTP/2 404
content-type: text/html
date: Sun, 04 Jul 2021 05:54:09 GMT
server: scaffolding on HTTPServer2
So I dont think its a EGRESS issue.
The Data location is US-east-1 for GCP and the pod local timezone is UTC, I am not sure if its a NTP sync issue. Need Advice. Same Code runs fine from my local with the same serviceaccount key. ( Just to mention I have done a kubectl cp to move the serviceaccount.json to the pod for testing later I'll create a configmap or something)

Why do I get a timeout when I want to start a new AWS Transcribe job?

I'm trying to use Amazon Transcribe, but whenever I start a new Transcribe job I receive the following timeout error:
Error Error: TimeoutError
at ClientRequest.<anonymous> (/Users/mrx/Desktop/Entwicklung/Backend/node_modules/#aws-sdk/credential-provider-imds/dist/cjs/remoteProvider/httpRequest.js:17:20)
at ClientRequest.emit (events.js:314:20)
at Socket.emitRequestTimeout (_http_client.js:715:9)
at Object.onceWrapper (events.js:420:28)
at Socket.emit (events.js:326:22)
at Socket._onTimeout (net.js:483:8)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7) {
'$metadata': { attempts: 1, totalRetryDelay: 0 }
}
EDIT: I also sometimes get the following "Unable to connect to instance metadata service" error:
Error ProviderError: Unable to connect to instance metadata service
at ClientRequest.<anonymous> (/Users/mrx/Desktop/Entwicklung/Backend/node_modules/#aws-sdk/credential-provider-imds/dist/cjs/remoteProvider/httpRequest.js:14:34)
at ClientRequest.emit (events.js:314:20)
at Socket.socketErrorListener (_http_client.js:427:9)
at Socket.emit (events.js:314:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
tryNextLink: true,
errno: 'EHOSTDOWN',
code: 'EHOSTDOWN',
syscall: 'connect',
address: '149.124.129.254',
port: 80,
'$metadata': { attempts: 1, totalRetryDelay: 0 }
}
That's what my transcribe_create_job.js file looks like:
const StartTranscriptionJobCommand = require("#aws-sdk/client-transcribe")
const transcribeClient = require("./libs/transcribeClient.js")
const dotenv = require('dotenv')
const result = dotenv.config({path: __dirname + '/./../../../../.env'})
if (result.error) {
throw result.error
}
// Set the parameters
const params = {
TranscriptionJobName: "Transcription Test",
LanguageCode: "en-US",
MediaFormat: "webm",
Media: {
MediaFileUri: "https://speech-recognition.s3.eu-central-1.amazonaws.com/djoqiipn.webm",
},
};
const run = async () => {
try {
const data = await transcribeClient.send(
new StartTranscriptionJobCommand(params)
);
console.log("Success - put", data);
return data; // For unit tests.
} catch (err) {
console.log("Error", err);
}
};
run()
That's what my transcribeClient.js file looks like:
const dotenv = require('dotenv')
const result = dotenv.config({path: __dirname + '/../.env'})
if (result.error) {
throw result.error
}
const { TranscribeClient } = require("#aws-sdk/client-transcribe");
const REGION = result.parsed.AWS_REGION
const transcribeClient = new TranscribeClient({ region: REGION });
module.exports = transcribeClient
I copied the code from the official documentation, but I can't figure out why I get this error. I don't find any explanation to this error online as well, so I hope somebody else knows why I get the error.
Thank you for your help in advance!
Maurice
Solved my problem by doing what I did here as well as adding AWS_REGION, AWS_ACCESS_KEY and AWS_SECRET_KEY to the client function.
const { TranscribeClient } = require("#aws-sdk/client-transcribe");
const transcribeClient = new TranscribeClient({ AWS_REGION, AWS_ACCESS_KEY, AWS_SECRET_KEY});
module.exports = { transcribeClient };
Please use this method
var params = {
Media: { /* required */
MediaFileUri: 'STRING_VALUE'
},
TranscriptionJobName: 'STRING_VALUE', /* required */
MediaFormat: webm,
};
TranscribeClient.startTranscriptionJob(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});

AWS Java SDK v2.10: QuickSightClient throws SdkClientException When Delete is Successful

quickSightClient.deleteUser(deleteUserRequest) throws a null pointer exception because it fails to marshall the 204 No Content response, which AWS Quicksight returns after successfully deleting a user.
My Questions:
Is there a better way to handle or avoid this problem than using a try/catch to swallow the error (see below)?
Should I report this as an bug in their GitHub project? I reported this GitHub Issue.
My Code:
private void deleteQuickSightUser() {
String awsAccountId = "..."
String roleName = "cc-embedding_quicksight_dashboard_role"
String email = "person#company.com"
String namespace = "default"
String roleArn = "arn:aws:iam::$awsAccountId:role/$roleName"
QuickSightClient quickSightClient = QuickSightClient.create()
User user = quickSightClient.listUsers(ListUsersRequest.builder()
.awsAccountId(awsAccountId)
.namespace(namespace)
.build()
).userList().find { it.email() == email }
if (user) {
log.error("found the $email user with username: $user.userName")
DeleteUserRequest deleteUserRequest = DeleteUserRequest.builder()
.awsAccountId(awsAccountId)
.namespace(namespace)
.userName(user.userName)
.build()
try {
/* *** THE FOLLOWING LINE THROWS THE EXCEPTION *** */
quickSightClient.deleteUser(deleteUserRequest)
} catch (SdkClientException e) {
log.error(e.message)
}
log.error("deleted user $user.email")
}
}
The Exception
2020-01-03 09:53:36.168 ERROR --- [nio-8080-exec-2] o.g.web.errors.GrailsExceptionResolver : NullPointerException occurred when processing request: [GET] /
Stacktrace follows:
java.lang.reflect.InvocationTargetException: null
at org.grails.core.DefaultGrailsControllerClass$ReflectionInvoker.invoke(DefaultGrailsControllerClass.java:211)
at org.grails.core.DefaultGrailsControllerClass.invoke(DefaultGrailsControllerClass.java:188)
at org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter.handle(UrlMappingsInfoHandlerAdapter.groovy:90)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: software.amazon.awssdk.core.exception.SdkClientException: Unable to unmarshall response (null). Response Code: 204, Response Text: No Content
at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:97)
at software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.handleSuccessResponse(HandleResponseStage.java:100)
at software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.handleResponse(HandleResponseStage.java:70)
at software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.execute(HandleResponseStage.java:58)
at software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.execute(HandleResponseStage.java:41)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:73)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:42)
at software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:77)
at software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:39)
at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage$RetryExecutor.doExecute(RetryableStage.java:113)
at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage$RetryExecutor.execute(RetryableStage.java:86)
at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:62)
at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:42)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:57)
at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:37)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.executeWithTimer(ApiCallTimeoutTrackingStage.java:80)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:60)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:42)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:37)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:26)
at software.amazon.awssdk.core.internal.http.AmazonSyncHttpClient$RequestExecutionBuilderImpl.execute(AmazonSyncHttpClient.java:240)
at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.invoke(BaseSyncClientHandler.java:96)
at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:120)
at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:73)
at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:44)
at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:55)
at software.amazon.awssdk.services.quicksight.DefaultQuickSightClient.deleteUser(DefaultQuickSightClient.java:1341)
at grails4test.ApplicationController.deleteUser(ApplicationController.groovy:85)
at grails4test.ApplicationController.doStuff(ApplicationController.groovy:44)
at grails4test.ApplicationController.index(ApplicationController.groovy:23)
... 13 common frames omitted
Caused by: java.lang.NullPointerException: null
at software.amazon.awssdk.core.io.SdkFilterInputStream.read(SdkFilterInputStream.java:66)
at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.ensureLoaded(ByteSourceJsonBootstrapper.java:522)
at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.detectEncoding(ByteSourceJsonBootstrapper.java:129)
at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.constructParser(ByteSourceJsonBootstrapper.java:246)
at com.fasterxml.jackson.core.JsonFactory._createParser(JsonFactory.java:1315)
at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:820)
at software.amazon.awssdk.protocols.json.internal.dom.JsonDomParser.parse(JsonDomParser.java:39)
at software.amazon.awssdk.protocols.json.internal.unmarshall.JsonProtocolUnmarshaller.unmarshall(JsonProtocolUnmarshaller.java:167)
at software.amazon.awssdk.protocols.json.internal.unmarshall.JsonResponseHandler.handle(JsonResponseHandler.java:79)
at software.amazon.awssdk.protocols.json.internal.unmarshall.JsonResponseHandler.handle(JsonResponseHandler.java:36)
at software.amazon.awssdk.protocols.json.internal.unmarshall.AwsJsonResponseHandler.handle(AwsJsonResponseHandler.java:43)
at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler$Crc32ValidationResponseHandler.handle(AwsSyncClientHandler.java:88)
at software.amazon.awssdk.core.client.handler.BaseClientHandler.lambda$interceptorCalling$2(BaseClientHandler.java:151)
at software.amazon.awssdk.core.client.handler.AttachHttpMetadataResponseHandler.handle(AttachHttpMetadataResponseHandler.java:40)
at software.amazon.awssdk.core.client.handler.AttachHttpMetadataResponseHandler.handle(AttachHttpMetadataResponseHandler.java:28)
at software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.handleSuccessResponse(HandleResponseStage.java:89)
... 45 common frames omitted
I think you should use try/catch for now and report this as a bug. What does the stack trace look like?

AWS Java SDK Error Message: The authorization header is malformed; the authorization header requires three components

I am getting following error while trying to put a file in AWS bucket
Error Message: The authorization header is malformed; the authorization header requires three components: Credential, SignedHeaders, and Signature. (Service: Amazon S3; Status Code: 400; Error Code: AuthorizationHeaderMalformed; Request ID: abc)
HTTP Status Code: 400
AWS Error Code: AuthorizationHeaderMalformed
Error Type: Client
Request ID: abc
I am using following code to do this task. Any idea what I am doing wrong.
AWSCredentials awsCredentials = new BasicAWSCredentials("key",", "secret");
AmazonS3 s3Client = new AmazonS3Client(awsCredentials);
s3Client.setRegion(com.amazonaws.regions.Region.getRegion(Regions.US_WEST_2));
String key = "test";
try {
s3Client.putObject(new PutObjectRequest(bucketName, key, file);
} catch (AmazonServiceException ase) {
System.out.println("Error Message: " + ase.getMessage());
System.out.println("HTTP Status Code: " + ase.getStatusCode());
System.out.println("AWS Error Code: " + ase.getErrorCode());
System.out.println("Error Type: " + ase.getErrorType());
System.out.println("Request ID: " + ase.getRequestId());
} catch (AmazonClientException ace) {
System.out.println("Caught an AmazonClientException, which means the client encountered "
+ "a serious internal problem while trying to communicate with S3, "
+ "such as not being able to access the network.");
System.out.println("Error Message: " + ace.getMessage());
}

Artifcatory - gradle: Could not publish configuration 'archives'

I am new to artifactory & gradle and am trying to setup them and getting the following error while publishing gradle artifacts:
15:14:44.544 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.UnsupportedOperationException
15:14:44.544 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.repositories.LegacyDependencyResolver.abortPublishTransaction(LegacyDependencyResolver.java:150)
15:14:44.544 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.IvyResolverBackedModuleVersionPublisher.publish(IvyResolverBackedModuleVersionPublisher.java:59)
15:14:44.544 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyDependencyPublisher$Publication.publishTo(DefaultIvyDependencyPublisher.java:77)
15:14:44.545 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyDependencyPublisher.publish(DefaultIvyDependencyPublisher.java:48)
15:14:44.545 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.IvyBackedArtifactPublisher.publish(IvyBackedArtifactPublisher.java:63)
15:14:44.545 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.tasks.Upload.upload(Upload.java:82)
15:14:44.545 [ERROR] [org.gradle.BuildExceptionReporter] ... 79 more
15:14:44.545 [ERROR] [org.gradle.BuildExceptionReporter]
And I have the following configuration in my build.gradle
apply plugin:'java'
apply plugin:'artifactory'
apply plugin:'maven'
buildscript {
repositories {
maven {
url 'http://localhost:9081/artifactory/plugins-release'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.9')
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
resolve {
repository {
repoKey = 'libs-release'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
........
........
........
def myJar = file('build/libs/myjar-1.0.jar')
artifacts {
archives myJar
}
uploadArchives {
repositories {
mavenRepo url: "http://localhost:9082/artifactory/libs-release-local";
repositories.mavenDeployer {
repository(url: "http://localhost:9082/artifactory/libs-release-local") {
authentication(userName: "${artifactory_user}", password: "${artifactory_password}")
}
pom.version = versionNumber
pom.artifactId = artifactId
pom.groupId = groupId
}
}
}
I can see the from the exception that Ivy resolver is being used but I am not setting up ivy to be used anywhere. Can someone please point out what is it I am doing wrong here?
You don't need to configure the uploadArchives task when using Artifactory plugin. The plugin configures it for you.