AWS Personalize "Input is not a valid Avro schema"

0

Hello, I try to build a CDK to setup an AWS Personalize environment. For me it look good, the Avro schema was copied from a tutorial of AWS. What is wrong with my Schema?

//AWS PErsonalize Init
    const cfnDatasetGroup = new personalize.CfnDatasetGroup(this, 'MyCfnDatasetGroupLAb62s', {
      name: 'pinpoint-recommendations-clothing',               
    });    

    const cfnSchema = new personalize.CfnSchema(this, 'MyCfnSchema', {
      name: 'pinpoint-recc-schema-clothing',
      schema: this.getPErsonalizeCsvSchemaJSON.toString(),           
    });

    const cfnDataset = new personalize.CfnDataset(this, 'MyCfnDataset', {
      datasetGroupArn: cfnDatasetGroup.attrDatasetGroupArn,
      datasetType: 'datasetType',
      name: 'pinpoint-recc-dataset-clothing',
      schemaArn: cfnSchema.attrSchemaArn,
    
      datasetImportJob: {                
        dataSource: {dataLocation: personalizeBucket.s3UrlForObject.toString()},
        jobName: 'pinpoint-importjob-clothing',
        //roleArn: 'roleArn',
      },
    });

The method behind is:

private getPErsonalizeCsvSchemaJSON() {    
    let content = {
      "type": "record",
      "name": "Interactions",
      "namespace": "com.amazonaws.personalize.schema",
      "fields": [
          {
              "name": "USER_ID",
              "type": "string"
          },
          {
              "name": "ITEM_ID",
              "type": "string"
          },
          {
              "name": "TIMESTAMP",
              "type": "long"
          }
      ],
      "version": "1.0"
    }
  return content
  }

And the error message is : "Input is not a valid Avro schema (Service: Personalize, Status Code: 400

asked a year ago288 views
1 Answer
0

To get a string representation of a map object in TypeScript/JavaScript, you need to use JSON.stringify(this.getPErsonalizeCsvSchemaJSON).

this.getPErsonalizeCsvSchemaJSON.toString() returns [object Object]

AWS
EXPERT
answered a year ago
profile pictureAWS
EXPERT
Chris_G
reviewed a year ago

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.

Guidelines for Answering Questions