1

I tried to using pinpoint services in my Lambda Function using Python Language. But I am facing time out error once Executed my function. Here is my lambda function source code.

import json
import boto3

client = boto3.client('pinpoint')


def trigger(event, context):
    print("---------1----------------")
    payload = {
      'TraceId': 'sadfasdf',
      'Context': {
        'string': 'string'
      }, 
      'MessageConfiguration': {
        'GCMMessage': {
          'RawContent': ""
        }
      },
      'TemplateConfiguration': {
        'PushTemplate': {
          'Name': 'coll-1-en'
        }
      }, 
      'Users': {
        "id": {
          "Substitutions":{
            "subject": ["string"],
            "id": ["120913"]
          }
        }
      }
    }
    try:
      print("---------2----------------")
      response = client.send_users_messages(
        ApplicationId='my_aws_pinpoint_services_project.id',
        SendUsersMessageRequest=payload
      )
      print("---------3----------------")
      data = response.read()
      print(data.decode("utf-8"))
      return response
    except Exception:
      return False

I am not sure what is the issue from my code. So I have inserted print("string") to find out the error lines.

The codes didn't executed since response = client.send_users_messages( line. So I was sure the client.send_users_messages had an issue. But I am not sure what is wrong in this line. Pls help me to fix this issue. I attached the screenshot of the Test result. enter image description here

0 Answers0