Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
victorCR
Visitor

roURLTransfer Timeout

Hi, I am making a request to an API from a task and the result is I am getting: a -28 as an error code and a message: "Connection timed out after 30005 milliseconds".

I tried making the same request on Postman and it is working fine. 

This is my while
While true
        msg = wait(0, m.port)

        If Type(msg) = "roUrlEvent"
            If msg.GetSourceIdentity() = request.GetIdentity()
                If msg.GetResponseCode() = 220
                    response = msg.GetString()

                    If response.len() <> 0
                        print ParseJson(response)
                        m.top.array = ParseJson(response)
                    Else
                        printDebug("Feed Failed")
                        m.top.statusCode = 102
                    End If
                Else
                    printError(msg)
                    printDebug("Feed Failed")
                    m.top.statusCode = msg.GetResponseCode()
                End If
            End If
        End If
    End While
0 Kudos
5 REPLIES 5
NB_
Roku Guru

Re: roURLTransfer Timeout

How long does the http response really take - is it over 30 seconds?
0 Kudos
victorCR
Visitor

Re: roURLTransfer Timeout

"RokuNB" wrote:
How long does the http response really take - is it over 30 seconds?

Its way less than that
0 Kudos
wburns
Visitor

Re: roURLTransfer Timeout

How is your API request structured? It might be a case that other parameters aren't being set, or not being brought into your task.

For example
  request = CreateObject("roUrlTransfer")
  request.SetCertificatesFile("common:/certs/certificate.crt")
  request.SetUrl(myUrl)
 response = request.GetToString()

And the error you're getting back, is it coming from the while loop, or is it a general error that's being returned?
Will Burns
Developer, REDspace
redspace.com
0 Kudos
victorCR
Visitor

Re: roURLTransfer Timeout

request = createObject("roUrlTransfer")
    printDebug("Making Request to " + m.top.fetchURL)
    'Enable this for custom config files'
    request.SetCertificatesFile("common:/certs/certificate.crt")
    request.EnablePeerVerification(false)
    request.SetUrl(m.top.fetchURL)
    request.SetMessagePort(m.port)
    request.AsyncGetToString()

That's the request I am sending.
Its just a simple GET with no parameters
0 Kudos
NB_
Roku Guru

Re: roURLTransfer Timeout

"victorCR" wrote:

    request.AsyncGetToString()

You say you are doing this in a Task, so you can as well use the synchronous .getToString() - if you do that, does it work?
(i am not saying AsyncGetToString() has issues, rather troubleshooting "from simple to complex", step by step)
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.