# Cannot return the items from dynanodb

**URL:** <https://forum.serverless.com/t/cannot-return-the-items-from-dynanodb/13191>\
**Category:** Serverless Framework\
**Tags:** aws, lambda, api-gateway, dynamodb\
**Created:** [November 23, 2020, 7:01pm UTC](https://forum.serverless.com/t/cannot-return-the-items-from-dynanodb/13191 "2020-11-23T19:01:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlejandroJMelo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/alejandrojmelo/32/4760_2.png) [@AlejandroJMelo](https://forum.serverless.com/u/AlejandroJMelo)\
**Post date:** [November 23, 2020, 7:01pm UTC](https://forum.serverless.com/t/cannot-return-the-items-from-dynanodb/13191/1 "2020-11-23T19:01:26Z")

</div>

Hi there, (First of all, sorry for my English XD)

I’m newbie trying get my first records from dynamodb (local).  
I don’t know why I can get the records, but I can’t send by the return.  
Here’s a fragment of my code. Any comments are welcome.

> module.exports.temperature = async(event,context)=\>{  
> console.log(‘[INFO] Get temperature from local DynamoDB’);
> 
> if(IS\_OFFLINE===‘true’){  
> console.log(‘[INFO] Definition of variables’);  
> var dynamodb = require(‘serverless-dynamodb-client’);  
> var rawClient = dynamodb.raw;  
> var params = {Key: {“id”: {N: “123”},“e”: {N: “1234”}}, TableName: “weather-station-dev”};  
> var Item;  
> console.log(‘[INFO] End definition of variables’);  
> console.log(‘[INFO] Get data from dynamoDB-local’);  
> await rawClient.getItem(params, function(err, data) {  
> if(err) console.log(‘[ERROR]’,err, err.stack);  
> else {  
> console.log(‘[INFO] Get data ====\>’,data);  
> Item = data;  
> console.log(‘[INFO] Get Item ====\>’,Item);  
> }  
> });  
> console.log(‘[INFO] Last line before return’);  
> return {  
> statusCode: 200,  
> body: JSON.stringify(  
> {  
> “Item”: Item  
> })  
> };  
> }else{  
> return {  
> statusCode: 200,  
> body: JSON.stringify(  
> {  
> message: ‘From AWS’  
> })  
> };  
> }  
> }

And for the console, I get this

> offline: GET /dev/temperature (λ: temperature)  
> [INFO] Get temperature from local DynamoDB  
> [INFO] Definition of variables  
> [INFO] End definition of variables  
> [INFO] Get data from dynamoDB-local  
> [INFO] Last line before return  
> offline: (λ: temperature) RequestId: ckhuwtsku0005rqx7d6mx4mad Duration: 75.84 ms Billed Duration: 100 ms  
> [INFO] Get data ====\> { Item: { e: { N: ‘1234’ }, id: { N: ‘123’ } } }  
> [INFO] Get Item ====\> { Item: { e: { N: ‘1234’ }, id: { N: ‘123’ } } }

I can get the information from de dynamoDB (local), but I can’t send to the page.

Thanks in advance.

Regards  
AJM
