Is there a way to return JSON on ALB lambda?How to access HTTP headers for request to AWS API Gateway using Lambda?API Gateway - Lambda proxy integration and asynchronous callAWS API Gateway Malformed Lambda ResponsePython lambda function returns KeyErrorReturning binary body and http headers from an AWS lambda through API gatewayReturning html from lambda function using expressAmazon Lambda - return docx file - Node.jsServe Binary responses via ALB and Lambda IntegrationI get an ALB Lambda error - 502 Bad GatewayReturning HTML response without API gateway in AWS Lambda for Node template
Will users know a CardView is clickable
Is pointing finger in meeting consider bad?
Am I being scammed by a sugar daddy?
What publication claimed that Michael Jackson died in a nuclear holocaust?
Does "aurea" have the second meaning?
ISP is not hashing the password I log in with online. Should I take any action?
How can religions without a hell discourage evil-doing?
How effective would a full set of plate armor be against wild animals found in temperate regions (bears, snakes, wolves)?
How Many Times To Repeat An Event With Known Probability Before It Has Occurred A Number of Times
usage of mir gefallen
A flower's head or heart?
Interview was just a one hour panel. Got an offer the next day; do I accept or is this a red flag?
I sent an angry e-mail to my interviewers about a conflict at my home institution. Could this affect my application?
Background for black and white chart
I received a gift from my sister who just got back from
Boss making me feel guilty for leaving the company at the end of my internship
What game uses dice with compass point arrows, forbidden signs, explosions, arrows and targeting reticles?
Would a bit of grease on overhead door cables or bearings cause the springs to break?
Jam with honey & without pectin has a saucy consistency always
How can I detect if I'm in a subshell?
Does WiFi affect the quality of images downloaded from the internet?
Short story about psychologist analyzing demon
Should I worry about having my credit pulled multiple times while car shopping?
Harley Davidson clattering noise from engine, backfire and failure to start
Is there a way to return JSON on ALB lambda?
How to access HTTP headers for request to AWS API Gateway using Lambda?API Gateway - Lambda proxy integration and asynchronous callAWS API Gateway Malformed Lambda ResponsePython lambda function returns KeyErrorReturning binary body and http headers from an AWS lambda through API gatewayReturning html from lambda function using expressAmazon Lambda - return docx file - Node.jsServe Binary responses via ALB and Lambda IntegrationI get an ALB Lambda error - 502 Bad GatewayReturning HTML response without API gateway in AWS Lambda for Node template
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have created lambda function on node.js which returns JSON.
It connected with API Gateway and worked well.
I want to connect it to amazon load balancer.
I tried it but it returns HTML page.
async function run(event)
let ret = ;
ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'
ret.code = 200;
return ret;
exports.handler = run;
How to return JSON?
aws-lambda aws-load-balancer
add a comment |
I have created lambda function on node.js which returns JSON.
It connected with API Gateway and worked well.
I want to connect it to amazon load balancer.
I tried it but it returns HTML page.
async function run(event)
let ret = ;
ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'
ret.code = 200;
return ret;
exports.handler = run;
How to return JSON?
aws-lambda aws-load-balancer
How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?
– Chetan Ranpariya
Mar 25 at 1:42
It returns blank page. I didn't use 'JSON.stringify' for JSON
– USER
Mar 25 at 3:06
add a comment |
I have created lambda function on node.js which returns JSON.
It connected with API Gateway and worked well.
I want to connect it to amazon load balancer.
I tried it but it returns HTML page.
async function run(event)
let ret = ;
ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'
ret.code = 200;
return ret;
exports.handler = run;
How to return JSON?
aws-lambda aws-load-balancer
I have created lambda function on node.js which returns JSON.
It connected with API Gateway and worked well.
I want to connect it to amazon load balancer.
I tried it but it returns HTML page.
async function run(event)
let ret = ;
ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'
ret.code = 200;
return ret;
exports.handler = run;
How to return JSON?
aws-lambda aws-load-balancer
aws-lambda aws-load-balancer
asked Mar 25 at 1:30
USERUSER
126212
126212
How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?
– Chetan Ranpariya
Mar 25 at 1:42
It returns blank page. I didn't use 'JSON.stringify' for JSON
– USER
Mar 25 at 3:06
add a comment |
How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?
– Chetan Ranpariya
Mar 25 at 1:42
It returns blank page. I didn't use 'JSON.stringify' for JSON
– USER
Mar 25 at 3:06
How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?
– Chetan Ranpariya
Mar 25 at 1:42
How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?
– Chetan Ranpariya
Mar 25 at 1:42
It returns blank page. I didn't use 'JSON.stringify' for JSON
– USER
Mar 25 at 3:06
It returns blank page. I didn't use 'JSON.stringify' for JSON
– USER
Mar 25 at 3:06
add a comment |
1 Answer
1
active
oldest
votes
Add a stringified body attribute to the response
async function run(event)
let ret = ;
ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'
,
'body': JSON.stringify(
test: 1
)
ret.code = 200;
return ret;
exports.handler = run;
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330260%2fis-there-a-way-to-return-json-on-alb-lambda%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Add a stringified body attribute to the response
async function run(event)
let ret = ;
ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'
,
'body': JSON.stringify(
test: 1
)
ret.code = 200;
return ret;
exports.handler = run;
add a comment |
Add a stringified body attribute to the response
async function run(event)
let ret = ;
ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'
,
'body': JSON.stringify(
test: 1
)
ret.code = 200;
return ret;
exports.handler = run;
add a comment |
Add a stringified body attribute to the response
async function run(event)
let ret = ;
ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'
,
'body': JSON.stringify(
test: 1
)
ret.code = 200;
return ret;
exports.handler = run;
Add a stringified body attribute to the response
async function run(event)
let ret = ;
ret =
'statusCode': 200,
'statusDescription': '200 OK',
'headers':
'Content-Type': 'application/json'
,
'body': JSON.stringify(
test: 1
)
ret.code = 200;
return ret;
exports.handler = run;
edited Mar 25 at 8:24
Thales Minussi
2,1771723
2,1771723
answered Mar 25 at 1:52
Dawid K.Dawid K.
1327
1327
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330260%2fis-there-a-way-to-return-json-on-alb-lambda%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How did you connect lambda function to load balancer? what end point you are calling when you get HTML back?
– Chetan Ranpariya
Mar 25 at 1:42
It returns blank page. I didn't use 'JSON.stringify' for JSON
– USER
Mar 25 at 3:06