Question

Reading json file from aws bucket using groovy script in groovy_scripting.

  • 13 July 2023
  • 3 replies
  • 132 views

Hi Team,
We are trying to read json file from aws s3 bucket using groovy script in groovy_scripting origin but we are facing one error

 “RETRY: SCRIPTING_10 - Script error in user script: javax.script.ScriptException: com.amazonaws.SdkClientException: Unable to load partition metadata from com/amazonaws/partitions/endpoints.json “

does anyone knows why we are getting this error? 
code snippet:-
 

 


3 replies

Userlevel 2

Why are you doing it this way? Can you not just use the Amazon S3 Origin? and set the delimiter as JSON with a suitably sized “Max Object Length (chars)” often the default is too small and drives errors.

Userlevel 5
Badge +1

@himanshu1234567 

Try with the below code after s3client object creation.

def s3Object = s3Client.getObject(new GetObjectRequest(bucketName, “gFolder/sample1.json”))

def s3Content = s3Object.getObjectContent()

def fileContent = s3Content.text

// Parse the JSON content

def jsonSlurper = new JsonSlurper()

def json = jsonSlurper.parseText(fileContent)

Please try print the json file content to check if it working or not.

 

 

hi @Bikram no suceess still getting same error in streamsets but code is working fine in intellij getting output also.

Reply