Recent Nightbot urlfetch changes break functionality

Asked Nov 6, 2026·10 replies·Last activity 19 days ago·Open in Discord ↗
This topic is closed
Still stuck? Ask the community on Discord.

10 replies

do you have more information than that? we did rewrite the internal service for this, but those headers should be identical

Things broke sometime over the last day or so. Unfortunately, I don't have heavy logging on the server side, and it's returning text, not json. What I found was that Nightbot started returning [Response must be less than 400 characters]. I couldn't figure out why, but I edited my urlfetch command to include extra channel details in the query string, and things started working properly.

The backend was designed to use the headers when they are available, and thus the additional channel details aren't usually included in the urlfetch command. Without that information, a much longer response is returned, which results in the over 400 characters message, so when things started working properly when sending the channel along explicitly, I was lead to believing the headers must be missing. No code was changed in the service being called.

@member When was this rewrite? I did have some weird header issue ~2 weeks ago with one of my apis, ill need to check what I changed. But i blamed that on me switching hosting, so maybe completely unrelated to this.

unfortunately you’ll need to provide logs for us to review. we don’t have much to go on from your post other than “it doesn’t work”. you may need to review your server logs to see how your server responds to the bot

shot in the dark, but the casing of the headers changed. by HTTP specifications it should not be case sensitive but i did deploy a change that restored the case of the headers

Thank you, @member . That fixed the issue. The service uses a PHP backend, and PHP will make headers available using the original casing for the header names rather than some normalized upper or lower case version. Had they normalized the header casing, it would force case-insensitivity, but as it stands, extra code would need to be added to make it case-insensitive.

I can certainly add code to make it case-insensitive. Please do let me know if you plan on changing the header casing again. With a little lead time, I can make the simple PHP changes to be work with it. In all honestly though, I should probably rewrite that whole backend to work with json.

it is typically best practice to normalize them then, array_change_key_case(getallheaders(), CASE_LOWER); would work

Didn't find your answer? The community is on Discord.

Ask on Discord