How do I resolve the invalid parameter error that I receive in Amazon SNS in response to API calls?

4 minute read
0

I receive an invalid parameter error message in Amazon Simple Notification Service (Amazon SNS) in response to API calls.

Resolution

The following sections provide steps to resolve invalid parameter errors.

Resolve platform credential errors

InvalidParameter - Error message: Invalid parameter: Attributes Reason: Platform credentials are invalid

Important: Before you complete the following steps to resolve the error, check the provider certificate type in your Apple Developer account. Then, download the certificate.

  1. Open the Amazon SNS console.

  2. On the navigation pane, choose Push notifications.

  3. Choose Create platform application.

  4. For Application name, enter a name for your application.

  5. For Push notification platform, select Apple iOS/VoIP/Mac.

  6. In the Apple Credentials section, select the Used for development in sandbox check box if you're using a certificate of type Sandbox.

    Important: You must not select this check box if you're using a certificate of type Sandbox & Production. Otherwise, you receive an error.

  7. For Push certificate type, select your type of certificate.

  8. Choose Choose file, and then select the certificate that you want to load credentials from.

  9. Choose Create platform application.

Resolve FIFO errors

"message": "Invalid parameter: The MessageGroupId parameter is required for FIFO topics"

You might see this error even if you provided the MessageID. Verify that you're using AWS SDK for JavaScript in the Browser or AWS SDK for JavaScript in Node.js version 2.777.0 or above.

You can receive Amazon SNS FIFO errors for invalid MessageGroupId or invalid MessageDeduplicationId even though the IDs are provided in the API request. Amazon SNS FIFO attributes are available for newer SDK versions only. For more information, see Changelog for AWS SDK for JavaScript on the GitHub website.

Resolve text messaging (SMS) errors

Couldn't set text messaging attributes.
Error code: InvalidParameter - Error message: Invalid parameter:

Complete these steps if you see this error:

  1. Open the Amazon SNS console.
  2. On the navigation pane, choose Text messaging (SMS).
  3. For Text messaging preferences, choose Edit.
  4. For Account spend limit - Optional Parameter, enter the numeric value 1. This default value is the monthly spend limit in USD. You can request an account spend limit increase if you want the account monthly spend limit to be greater than $1.
  5. Note: By default, every Amazon SNS account has a spend quota of $1 in every AWS Region. You receive an error in the Amazon SNS console when the value is greater than 1.
  6. Choose Save changes.

Resolve subscription delete errors

Couldn't delete subscription.
Error code: InvalidParameter - Error message: Invalid parameter: SubscriptionArn Reason: An ARN must have at least 6 elements, not 1

You receive this error when you try to remove a subscription that's in PendingConfirmation status. To remove a subscription, the Amazon SNS Unsubscribe API is called, which requires SubscriptionARN. If you use the console to delete the subscription, then the Amazon SNS console automatically selects the SubscriptionARN from the selected subscription. For a subscription in PendingSubscription status, the console doesn't show SubscriptionId. As a result, the console uses the PendingConfirmation as a SubscriptionId. Then, the API call fails and returns an error.

For a subscription in Pending confirmation status:

  1. Open the Amazon SNS console.
  2. On the navigation pane, choose Topics, and then choose your topic.
  3. Select the topic with the subscription in Pending confirmation status, and then select the subscription in Pending confirmation status.
  4. Choose Request confirmation.

A subscribe notification is sent to the endpoint to confirm the subscription.

  1. Copy the subscribe URL from the notification. This URL looks similar to the following:

    https://sns.us-east-1.amazonaws.com/confirmation.html?TopicArn=arn:aws:sns:your-aws-region:your-account-number:your-topic-name&Token=your-token&Endpoint=your-endpoint
  2. On the navigation menu in Amazon SNS, choose Subscriptions, and then select your subscription.

  3. Choose Confirm subscription.

  4. Paste the subscribe URL from step 5 into the dialog box, and then choose Confirm subscription

  5. Select your subscription, and then choose Delete.

For a subscription with Deleted status:

Check the endpoint where the unsubscribe link was chosen. After the subscription is unsubscribed, the endpoint receives another notification similar to the following:

Your subscription to the topic below has been deactivated:
arn:aws:sns:Your-AWS-Region:Your-Account-Number:Your-Topic-Name

If this was in error or you wish to resubscribe, click or visit the link below:
Resubscribe

Please click on the resubscribe link present in the notification. This will confirm the subscription. On success, please select the specific subscription and click on Delete button.

-or-

Wait three days for the subscription to be removed. By default, Amazon SNS automatically removes subscriptions with PendingConfirmation in three days.

AWS OFFICIAL
AWS OFFICIALUpdated 3 months ago