How to fix HTTP failed - ISteamHTTP isn't available
Many addons display an HTTP failed error - ISteamHTTP isn't available! since the update of GMod (August 2020). If this error suddenly appeared in the logs of your garry's mod server, be aware that it was already present but silent.
HTTP failed - ISteamHTTP isn't available!
The developers of the game have changed the behavior of HTTP, which now displays errors that were previously ignored.
The changes that affect us are as follows:
- Fixed HTTP() global trying to use invalid ISteamHTTP pointer after changelevel on dedicated servers causing a crash
- Promoted "HTTP failed - ISteamHTTP isn't available!" to an ErrorNoHalt with stack to help identify what addon is causing the error message
Lua Error: [myaddon] HTTP failed - ISteamHTTP isn't available! 1. Fetch - lua/includes/modules/http.lua:42 2. unknown - addons/myaddon/lua/shared/sh_init.lua:8
The HTTP library is an internal function of STEAM and is initialized quite late when starting your GMod server. To be sure that HTTP is ready for use, you have to wait for the first tick of the server, that is, the server is fully started and ready to host the player connection.
How to fix HTTP failed error?
Here is an example, if you want to check for example if an addon is in its latest version. To make sure that the server is running, we'll use a player's connection hook. There is no event to say that the server is ready, so you should use this kind of tip:
hook.Add("PlayerConnect", "CheckVersionOfMyAddon", function() Msg( "Check version of MyAddon\n" ) http.Fetch("https://site.com", function(result) Msg(" Connection established\n") end, function(failed) Msg(" Connection failed : "..failed.."\n") end ) hook.Remove("PlayerConnect", "CheckVersionOfMyAddon") end)
The error is present in an addon that you have not developed yourself, and you can't fix it? Contact the addon developer.