I get the error "USER ERROR: Condition "err != 0 && err != 1" is true. Returning: FAILED" only on compiled project

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TheZero3546

I’m doing some tests with http requests.
i have the following code on my scene

var http_request: HTTPRequest

# Called when the node enters the scene tree for the first time.
func _ready():
	http_request = HTTPRequest.new()

func on_request_completed(result, response_code, headers, body):
	var json = JSON.new()
	print('created json')
	print('parsed json')
	$CenterContainer/VBoxContainer/Label.text = str(json.get_data())

func _on_button_pressed():

it works fine when debugging
enter image description here

but when i compile it and upload to the server it returns an error and i don’t understand why
enter image description here

The http request returns the correct json