1

I'm having a problem when connecting Dynamodb and trying to show an item on Chalice response.

When I access the link, my API shows this error: {"Message": "An internal server error occurred.", "Code": "InternalServerError"}

I try to change the code anyway, but when it is outputed on the console, the code runs normally displaying the name.

My code:

  import boto3
  from chalice import Chalice

  app = Chalice(app_name='LogIn')
  db = boto3.resource('dynamodb')
  tabela = db.Table('Account')

  @app.route('/nome')
  def home():
   return "ola, amigo"+ (tabela.get_item(key={'Id':2,'name':"teste2"}))['nome']

   @app.route('/input')
   def login():
     tabela.put_item(Item={'Id':2,'name':"teste3"})

I expect the output to show the name.

J_Zoio
  • 338
  • 1
  • 3
  • 16
  • Check your actual error from cloudwatch logs of the lambda created by chalice. Internal server error is just saying that some unknown error occurred. – Ninad Gaikwad Jan 07 '19 at 07:01
  • Try with logs running `chalice logs`. If you're working on a different stage than `dev` try: `chalice logs --stage `. Debugging setting `app.debug = True`, if not in production, is always a good option. – maxrodrigo Jan 23 '19 at 23:31

0 Answers0