Issue
Following is my code:
try (CSVReader reader = new CSVReader(new FileReader(csvFile.getAbsolutePath()))) {
//List<String[]> r = reader.readAll();
String[] lineInArray;
int count = 0;
while ((lineInArray = reader.readNext()) != null) {
String interId = lineInArray[0];
String fileId = null;
String mp3Name = null;
List<Map<String, Object>> filesList = ccrDao.retrieveCallIdAndPaths(interId);
for (Iterator iterator = filesList.iterator(); iterator.hasNext();) {
Map<String, Object> map = (Map<String, Object>) iterator.next();
fileId = map.get("C_CALL_ID")!=null?map.get("C_CALL_ID").toString():"";
mp3Name = map.get("C_FILENAME")!=null?map.get("C_FILENAME").toString():"";
if(!fileId.equals("") && !mp3Name.equals("")) {
String blobName = fileId+"/"+mp3Name;
context.getLogger().info("blobName: "+blobName);
BlobClient sourceBlobClient = srcContainer.getBlobClient(blobName);
context.getLogger().info("source blob client");
BlobClient destBlobClient = dstnContainer.getBlobClient(blobName);
context.getLogger().info("destination blob client");
if(!destBlobClient.exists()) {
context.getLogger().info("blobName doesnt exist :"+blobName);
BlobServiceSasSignatureValues sas = new BlobServiceSasSignatureValues(OffsetDateTime.now().plusHours(1), BlobContainerSasPermission.parse("r"));
String sasToken = sourceBlobClient.generateSas(sas);
context.getLogger().info("generated sas token :"+sasToken);
destBlobClient.beginCopy(sourceBlobClient.getBlobUrl()+"?"+ sasToken,null);
//destBlobClient.copyFromUrl(sourceBlobClient.getBlobUrl());
context.getLogger().info(interId+"copied successfully");
}else {
context.getLogger().info("blob already exists");
}
}else {
context.getLogger().info("No file is present");
}
}
count++;
context.getLogger().fine("Recourd Count "+count);
}
} catch (Exception e ) { //IOException | CsvException
context.getLogger().severe("Error occured while copying the data :"+e.getMessage());
e.printStackTrace();
}
Getting below error on line
"destBlobClient.beginCopy(sourceBlobClient.getBlobUrl()+"?"+ sasToken,null);"
body {font-family:Arial; margin-left:40px; }img { border:0 none; }#content { margin-left: auto; margin-right: auto }#message h2 { font-size: 20px; font-weight: normal; color: #000000; margin: 34px 0px 0px 0px }#message p { font-size: 13px; color: #000000; margin: 7px 0px 0px0px}#errorref { font-size: 11px; color: #737373; margin-top: 41px }Service unavailableOur services aren't available right now
We're working to restore all services as soon as possible. Please check back soon.
0XjmzYAAAAAC2Ast2oBmIS47phNpxTuFBQk9NMDFFREdFMDIxOQA3ZGIwYWMxYy1iNzZkLTRiYTQtYTE3NS01NTgxNTUxMTEzZDU=Error in Scheduler worker in group main failed with an uncaught exception.Solution
As suspected the issues was not related to tier or any scaling issue. While executing my function was not showing the complete logs and my code also unable to catch the exception so I followed below steps.
- Checked the "host" logs via Kudu -Debug Console.
- Able to find the actual error at beginCopy() step as stated below
2021-05-31T14:37:48.513 [Information] 2021-05-31 14:37:48.494 ERROR 5820 --- [ parallel-1] reactor.core.scheduler.Schedulers : Scheduler worker in group main failed with an uncaught exception 2021-05-31T14:37:48.513 [Information] java.lang.NoSuchMethodError: okhttp3.RequestBody.create(Lokio/ByteString;Lokhttp3/MediaType;)Lokhttp3/RequestBody;
- After doing analysis on above error, override the okhttp version in my pom.xml by adding below dependency
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version>
</dependency>
- clean package and replace all the libraries with the existing one. Don't just replace one library in the function app as its dependent libraries like okio jar also has to update
Answered By - SRN