question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failure to call .end() on the response object in an HttpEndpoint leads to confusing behavior

See original GitHub issue

It would appear that if you don’t call .end() on the response object in the function that handles your cloud.HttpEndpoint when you make a request, you get a 502 error from API Gateway.

I was trying to write a brain dead simple hello world app and originally wrote

// Copyright 2016-2017, Pulumi Corporation.  All rights reserved.

import * as cloud from "@pulumi/cloud";

const app = new cloud.HttpEndpoint("hello");

app.get("/hello", async (req, res) => {
    res.write("Hello, world");
});

export let endpointUrl = app.publish().url.then(url => url)

This deploys correctly but you hit errors when you try to curl the endpoint. If you add a call to .end() after .write() then things work.

What’s even worse (maybe?) is that I found this impossible to debug. pulumi logs did not show me anything, the CloudWatch log group for the lambda did not show any errors (you could see events for start and stop each time you hit the endpoint). Pat, MattDR and I spent a bunch of time in the AWS console trying to send test events to the lambda and understand responses before I thought to go look at an existing application that had an HttpEndpoint and read the implementation.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lukehobancommented, Jan 3, 2018

Note that send and end are synonyms. We definitely need to add send as well - and that may help on the front end of this problem.

My primary concern is how we can make debuggability better on the backend of this - since that’s where we are likely to hit a larger class of issues with it being difficult to diagnose what’s happening during “expected” classes of failures in Node. Not sure what the answer is there though…

0reactions
lukehobancommented, Jan 15, 2020

Unlikely we’ll make targeted improvements like this - more likely we’ll more broadly rethink this library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Http GET call failure in practice (checked with web HTTP test ...
here I get the response into response object and here is the response: "shadows klass" which is not clear to me.
Read more >
HTTP endpoint configuration HOWTO - stubby4j
This page explains the usage, intent and behavior of each property on the request and response, regex stubbing for dynamic matching, stubbing HTTP...
Read more >
HTTP Endpoint Delivery Request and Response Specifications
If a response fails to conform to the requirements below, the Kinesis Firehose server treats it as though it had a 500 status...
Read more >
A Detailed Overview of AWS API Gateway - Alex DeBrie
The integration is where API Gateway will route your request once it passes authorization and validation. An integration could be a Lambda ...
Read more >
Fix list for IBM WebSphere Application Server V8.5
toString() when object not in allowlist ... PH40829, Websphere Application Server tries to invoke TLS1.3 and fails even though it is not the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found