Nate
Nate

Reputation: 13252

"Expected params.Attributes[Enabled] to be a string" when calling setEndpointAttributes

I just got this error and solved it and figured I'd share this obscure bit of knowledge.

Expected params.Attributes[Enabled] to be a string

when calling setEndpointAttributes

var AWS = require("aws-sdk");
var sns = new AWS.SNS();
var params = {
  Attributes: {
    Enabled: true,
  },
  EndpointArn: "...",
};

sns.setEndpointAttributes(params, function(err, resp){
  // err.message => "Expected params.Attributes[Enabled] to be a string"
  // ...
});

Upvotes: 1

Views: 1364

Answers (1)

Nate
Nate

Reputation: 13252

var AWS = require("aws-sdk");
var sns = new AWS.SNS();
var params = {
  Attributes: {
    Enabled: "true",
    //       ^    ^ Quote the variable
  },
  EndpointArn: "...",
};

sns.setEndpointAttributes(params, function(err, resp){
  // ...
});

Upvotes: 1

Related Questions