Skip to content

Object literal may only specify known properties, and ''job-bookmark-option'' does not exist in type 'JSON'

0

I have below cdk code in stack.ts for AWS glue where i try to set enable Job bookmark option:

const L2gluejob = new GlueJob(this, 'obs_rep_job', {
      jobName: 'OBS table replication',
      workerType: 'G.1X',
      numberOfWorkers: 10,      
      DefaultArguments: {'--job-bookmark-option': 'job-bookmark-enable'},
      timeout: Duration.hours(1),
      glueVersion: '4.0',
      connections: [obs_gluedbconnection],
      script: GlueScript.fromAsset(this, 'obs_table_replication', './OBS Table Replication.py'),
      outputbucket: GlueBucketPath,
      outputbucketname: GlueBucket
    });

In job.ts i declared the DefaultArguments variable as JSON.

readonly DefaultArguments?: JSON;
this.job = this.createJob(this, 'Resource', {
      name: props.jobName,
      role: this.role.roleArn,
      workerType: props.workerType,
      numberOfWorkers: props.numberOfWorkers,
      DefaultArguments: props.DefaultArguments,
      timeout: props.timeout.toMinutes(),
      glueVersion: props.glueVersion,
      connections: { connections: props.connections?.map(connection => connection.connectionName) }

But i am getting error in stack.ts as below :

Object literal may only specify known properties, and '' job-bookmark-option'' does not exist in type 'JSON'.ts(2353)
job.ts(34, 12): The expected type comes from property 'DefaultArguments' which is declared here on type 'GlueJobProps'

When i checked aws article they mentioned how to declare DefaultArguments variable and define enable Job bookmark option but i dont know why it doesnt work. https://repost.aws/knowledge-center/cloudformation-glue-special-parameters

1 Answer
1

Do you need this declaration ?

readonly DefaultArguments?: JSON;

Your glue job should look a bit like this

const L2gluejob = new glue.CfnJob(this, "obs_rep_job", {
      name: "OBS table replication",
      role: gluer_role.roleArn,
      command: {
        name: "glueetl",
        pythonVersion: "3",
        scriptLocation: GlueScript.fromAsset(this, 'obs_table_replication', './OBS Table Replication.py'),
      },
      defaultArguments: {
        "--job-bookmark-option": "job-bookmark-disable",
        "--output_bucket_name": GlueBucket,
        "--output_prefix_path": GlueBucketPath
      },
      connections: {
        connections: ["obs_gluedbconnection"]
      },
      timeout: 60,
      numberOfWorkers: 10,
      glueVersion: "4.0",
      workerType: "G.1X",
});
EXPERT

answered 2 years ago

  • Thanks for the feedback. It worked now!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.