lambda invoked by APIgateway through postman works but not SDK

0

When I use postman to call my lambda function invoked by APIgateway, it returns the result, but through SDK I always get exception with status 0. I'm not sure how I should be returning my result from lambda to work with SDK. This is what I have in my lambda function which works fine and returns expected value using postman.

return { 'statusCode': 200, 'headers': { 'Content-Type': 'text/html', }, 'body': htmlStr }

but in SDK it messes up, here's my code:

var body = { "id": REST_DATA.selectedPatId, "date": JSON.parse(record.sleepdata).Start_Date, "starttime":JSON.parse(record.sleepdata).Start_Time, "user":REST_DATA.restTrackerLoginUser };

var additionalParams = { headers: { 'Content-Type': 'text/html',
}, };

apigClient.spectogramPost(null, body, additionalParams) .then(function(result){ debugger; // Add success callback code here. }).catch( function(result){ // ALWAYS COMES HERE });

{data: '', status: 0, statusText: '', headers: {…}, config: {…}} config : {method: 'POST', headers: {…}, timeout: 0, transformRequest: Array(1), transformResponse: Array(1), …} data : "" headers : {} status : 0 statusText : ""

답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠