"agent stopped"?

Hi,

I’m getting a “No HTTP Handler” response at my agent URL and the IDE says “device online / agent stopped”.

Any reason why this might be? Anything I can do about it? FYI the agent URL is [edit]not such a good idea to post publicly :)[/edit].

Thanks!

  • Yakov

Can you post agent code?

Are you calling http.onrequest()?

Yes, http.onrequest() is being called.

Here’s an edited-down version of the code, which still comes up the same error:


`
// Log the URLs we need
server.log("Drive the car: " + http.agenturl() + “?drive”);
local page = “Hi!”;

function requestHandler(request, response) {
try {
if (“u” in request.query) {
// Process the request.
response.send(200, “sent”);
} else if (“drive” in request.query) {
response.send(200, page)
} else if (“status” in request.query) {
if (device.isconnected()) {
response.send(200, “Connected”);
} else {
response.send(200, “Disconnected”);
}
} else {
// send a response back saying everything was OK.
response.send(200, “Please go to ?drive.”);
}
} catch (ex) {
response.send(500, "Internal Server Error: " + ex);
}
}

// register the HTTP handler
http.onrequest(requestHandler);
`

Hmm, yeah that looks fine.

If you PM me the agent url and device ID we can see if something funky is going on in the backend.

Interestingly, power cycling the imp resolved the issue.

Thanks for the tip!