aws sdk - SNS sending CreateTopicCommand I got Invalid parameter: DataProtectionPolicy Reason: Failed to parse the data protecti

admin2025-04-17  3

I created on aws a "Push notification platform - Apple iOS (development)"

I am just trying to create a new endpoint from AWS SDK JS v3

    const deviceId = 'a0b1c2d3e4f5' // would be a real deviceId
    const createEndpointResponse = await client.send(
        new CreatePlatformEndpointCommand({
            PlatformApplicationArn: platformArn,
            Token: deviceId,
        })
    )
    const createTopicResponse = await client.send(
        new CreateTopicCommand({
            DataProtectionPolicy: 'STRING_VALUE',
            Name: 'PushNotificationTestTopic',
        })
    )
    console.log('Device-specific topic ARN', createTopicResponse.TopicArn )
    const topicArn = createTopicResponse.TopicArn

I get this error

{"errorType": "InvalidParameterException", "errorMessage": "Invalid parameter: DataProtectionPolicy Reason: Failed to parse the data protection policy"

I created on aws a "Push notification platform - Apple iOS (development)"

I am just trying to create a new endpoint from AWS SDK JS v3

    const deviceId = 'a0b1c2d3e4f5' // would be a real deviceId
    const createEndpointResponse = await client.send(
        new CreatePlatformEndpointCommand({
            PlatformApplicationArn: platformArn,
            Token: deviceId,
        })
    )
    const createTopicResponse = await client.send(
        new CreateTopicCommand({
            DataProtectionPolicy: 'STRING_VALUE',
            Name: 'PushNotificationTestTopic',
        })
    )
    console.log('Device-specific topic ARN', createTopicResponse.TopicArn )
    const topicArn = createTopicResponse.TopicArn

I get this error

{"errorType": "InvalidParameterException", "errorMessage": "Invalid parameter: DataProtectionPolicy Reason: Failed to parse the data protection policy"

Share Improve this question asked Jan 30 at 17:02 realteborealtebo 25.7k45 gold badges126 silver badges216 bronze badges 1
  • This may be unrelated to this specific API call, the DataProtectionPolicy is part of the SNS Topic, maybe something is messed up there and it validates it while you create the platform endpoint. – Maurice Commented Jan 31 at 16:46
Add a comment  | 

1 Answer 1

Reset to default 0

I ended removing

"DataProtectionPolicy: 'STRING_VALUE',"

it now works

转载请注明原文地址:http://www.anycun.com/QandA/1744903433a89255.html