# Request-\>OnProcessRequestComplete() gets called only on first play session

**URL:** <https://forums.unrealengine.com/t/request-onprocessrequestcomplete-gets-called-only-on-first-play-session/2080155>\
**Category:** C++\
**Tags:** Networking, network-error, network-deployment, httprequest, network-replay, networking-replicat, networking-multipla, unreal-engine, question\
**Created:** [October 22, 2024, 1:21pm UTC](https://forums.unrealengine.com/t/request-onprocessrequestcomplete-gets-called-only-on-first-play-session/2080155 "2024-10-22T13:21:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quantum\_GO](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Quantum\_GO](https://forums.unrealengine.com/u/Quantum_GO)\
**Post date:** [October 22, 2024, 1:21pm UTC](https://forums.unrealengine.com/t/request-onprocessrequestcomplete-gets-called-only-on-first-play-session/2080155/1 "2024-10-22T13:21:41Z")

</div>

I have been trying to fix this for a while, but to no success, which is why I have come to here to hopefully get an answer to what is going wrong. I am writing a little tool so our team can submit bugs to Trello through the game itself. I have set this up and it sort of works, sort of meaning it only works on the first play session after opening the engine, all the following play sessions will work only partly.

It works perfectly during the first play session (but only in engine, not in a packaged build). Every following session, nothing seems to be called after Request.OnProcessRequestComplete() for whatever reason and I cannot figure out why. All of this is located inside of a singleton class for blueprint utilities.

Here is the code that is responsible for this

```auto
void UHttpUtilities::SubmitCardToTrello(const FString& CardName, const FString& CardDescription, const TArray<FString>& CardLabels, const FString& ImageFilePath)
{
	ImagePath = ImageFilePath;
	
	FHttpModule* Http = &FHttpModule::Get();
	TSharedRef<IHttpRequest, ESPMode::ThreadSafe> Request = Http->CreateRequest();

	FString LabelIDString;
	for (const FString& Label : CardLabels)
	{
		LabelIDString += FString::Printf(TEXT("\"%s\", "), *Label);
	}

	if(LabelIDString.Len() > 0)
	{
		LabelIDString.RemoveAt(LabelIDString.Len() - 2, 2);
	}

	LabelIDString = FString::Printf(TEXT("[%s]"), *LabelIDString);

	const FString URL = FString::Printf(TEXT("https://api.trello.com/1/cards?idList=%s&key=%s&token=%s"), *CardListID, *APIKey, *APIToken);

	Request->SetURL(URL);
	Request->SetVerb("POST");

	Request->SetHeader("Content-Type", "application/json");
	Request->SetHeader("Cache-Control", "no-cache");
	Request->SetHeader("Pragma", "no-cache");

	//Create request body
	FString RequestBody = FString::Printf(TEXT(
			"{ \"name\": \"%s\", \"desc\": \"%s\", \"idList\": \"%s\", \"key\": \"%s\", \"token\": \"%s\", \"idLabels\": %s }"),
			*CardName, *CardDescription, *CardListID, *APIKey, *APIToken, *LabelIDString);

	Request->SetContentAsString(RequestBody);
	
	Request->OnProcessRequestComplete().BindUObject(this, &UHttpUtilities::OnResponseReceived);

	if(Request->ProcessRequest())
	{
		UE_LOG(LogTemp, Warning, TEXT("Trello request sent successfully."));
	}
	else
	{
		UE_LOG(LogTemp, Error, TEXT("Failed to send Trello request!"));
	}
}

```

If anyone has any clue, I would much appreciate it!

---

<div class="post-metadata">

**Author:** ![Quantum\_GO](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Quantum\_GO](https://forums.unrealengine.com/u/Quantum_GO)\
**Post date:** [October 23, 2024, 7:25am UTC](https://forums.unrealengine.com/t/request-onprocessrequestcomplete-gets-called-only-on-first-play-session/2080155/2 "2024-10-23T07:25:02Z")

</div>

A bit of an update on this. I have confirmed that I am not getting a response back from Trello on every play session besides that first one where everything works perfectly. I have doubts that the issue is on Trello’s side however, it’s much more likely either I am doing something wrong or something funky is happening in Unreal’s background somehow.

---

<div class="post-metadata">

**Author:** ![Quantum\_GO](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Quantum\_GO](https://forums.unrealengine.com/u/Quantum_GO)\
**Post date:** [October 30, 2024, 9:57am UTC](https://forums.unrealengine.com/t/request-onprocessrequestcomplete-gets-called-only-on-first-play-session/2080155/3 "2024-10-30T09:57:48Z")

</div>

Another update. The issue also exists when you change from one level to another. I thought maybe it had to do with it being derived from a UObject so instead I made it a child of UUserWidget, this just gives me the exact same result however. The request times out without giving me a response back, but the cards are still being created in Trello.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [October 30, 2024, 10:22am UTC](https://forums.unrealengine.com/t/request-onprocessrequestcomplete-gets-called-only-on-first-play-session/2080155/4 "2024-10-30T10:22:13Z")

</div>

Perhaps try increasing the timeout period in the request via IHttpRequest

 ![obraz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/b/6/db6f657b9313cbbf965a0e93c5bf2bb60daaa27d.png)

The server processing your request might have you as low priority so you may not be getting responses in the needed time window.

Try looking into an external tool to monitor network traffic. Perhaps looking into the transport of the data itself might let you know where the communication fails.

Something like Wireshark might do the job.

---

<div class="post-metadata">

**Author:** ![Quantum\_GO](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Quantum\_GO](https://forums.unrealengine.com/u/Quantum_GO)\
**Post date:** [October 30, 2024, 12:25pm UTC](https://forums.unrealengine.com/t/request-onprocessrequestcomplete-gets-called-only-on-first-play-session/2080155/6 "2024-10-30T12:25:21Z")

</div>

I had already increased the timeout to 60 seconds and that unfortunately did not do anything.

However, I kind of fixed it, but not in a way that should be used to fix it I am fairly certain. What I ended up doing is forcably flush the request a bit after it has been sent, meaning it is forced to complete the request (At least I think so) After doing that it seems to work perfectly now, however I am aware that if we will do anything else related to Http requests, it might ■■■■ it up in some way, but that might just be an issue for later.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [October 30, 2024, 12:27pm UTC](https://forums.unrealengine.com/t/request-onprocessrequestcomplete-gets-called-only-on-first-play-session/2080155/7 "2024-10-30T12:27:48Z")

</div>

You could move the http request handling to a singleton subsystem based on gameInstance. You would have only one instance then and you wouldn’t run into calling 2 requests simultaneously if that is what you need.

---

<div class="post-metadata">

**Author:** ![Quantum\_GO](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Quantum\_GO](https://forums.unrealengine.com/u/Quantum_GO)\
**Post date:** [October 30, 2024, 12:34pm UTC](https://forums.unrealengine.com/t/request-onprocessrequestcomplete-gets-called-only-on-first-play-session/2080155/8 "2024-10-30T12:34:49Z")

</div>

I’ve actually done this as well, it was a singleton class I made for http utilities in blueprints, what I’ve ended up with is just making it a UUserWidget derived class, that however was not the thing that fixed it, only the flushing seems to have worked after trying an incredible amount of things to fix it.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [October 30, 2024, 12:44pm UTC](https://forums.unrealengine.com/t/request-onprocessrequestcomplete-gets-called-only-on-first-play-session/2080155/9 "2024-10-30T12:44:34Z")

</div>

You could add the flush command within the function bound to the rquestcomplete delegate function. It would then trigger at the correct time.(you might already have this)

Or as a cleanup function that is triggered if it fails or succeeds.

Also have you seen this thread regarding ssl?

> [@No response (fail or success) on HTTP calls](https://forums.unrealengine.com/t/no-response-fail-or-success-on-http-calls/489259/4):
>
> Turns out the reason here was an SSL error between UE and my server. UE didn’t trust the certificate authority of my server, and gave up on the HTTP request. When that happens, no error callback is triggered for some reason. My first workaround was to use HTTP instead of HTTPS for all calls. I then found that the fix from [https://answers.unrealengine.com/questions/840027/when-playing-in-the-editor-websocket-connection-su.html](https://answers.unrealengine.com/questions/840027/when-playing-in-the-editor-websocket-connection-su.html) fixes it; copying the cacert.pem file from engine to the project and …

It also tackles a lack if response but it due to certificates.
