无法使用 Python SDK 在 AWS SNS 中为 FCM 创建平台应用程序

Can't Create Platform Application for FCM in AWS SNS using Python SDK

尝试使用 Python SDK (boto3)

为 AWS 的 SNS 创建平台应用程序
client = session.client('sns')
response = client.create_platform_application(
    Name="firebase",
    Platform='FCM',
    Attributes={
        'PlatformCredential': [FCM_SERVER_KEY]
    }
)

返回以下错误:

botocore.errorfactory.InvalidParameterException: An error occurred (InvalidParameter) when calling the CreatePlatformApplication operation: Invalid parameter: Platform Reason: FCM is not supported

如果我在 AWS 控制台中创建它,它工作正常。它只是部分 boto3 实现吗?

看起来平台应该是 GCM 而不是 FCM 尽管它是一个 firebase 平台。 所以正确的代码是:

response = client.create_platform_application(
    Name="firebase",
    Platform='GCM',
    Attributes={
        'PlatformCredential': [FCM_SERVER_KEY]
    }
)
``