The problem is, it sends a request with an error. For some reason there is an undefined and empty object in the end and I have no idea where it comes from. If I remove query() at all it stays anyway.
to log requests and response, and this is what I get
9:46:46.111 | SERVER_CODE | INFO | [24609] GET https://some.api.url/latest/price?marketing_type=sell undefined {}
19:46:46.196 | SERVER_CODE | ERROR | [24609] Error:
So I assume that it is a request url is being composed that way, I tried hitting that api just from browser with that in the end and I get exactly same error what I get here.
The body (undefined - because this is a GET request, there are no body in GET request, it’s OK)
The headers (empty object, no custom headers passed)
So, this is not the root of the error.
I tried to open this URL in my browser and see that this URL is just not valid - some.api.url - is not a registered domain, seems it’s just some copied example value from docs or tutorial.
Or maybe you have changed real domain to some.api.url for this topic only on purpose?
In any case, you should see the error text right after 19:46:46.196 | SERVER_CODE | ERROR | [24609] Error: log. Do you see something there?
Okay, I think I finally figured out the issue. Seems like it works from curl, from browser and from phone, but not from the Event Handler, I think backendless is blocked or restricted in some way. Is there a way to get a dedicated IP address for cloud code or something like that to bypass that issue?
Yes, seems like AWS WAF firewall thinks that Backendless is a bot. That is what I get
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD>
<BODY>
<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px"> Request blocked. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all"> If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: _TfRXvHPIiWd2QoWdt_PvhZGhcJR0Ak1xKn_8H5vd8GZVs_9NgyT9FA==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY>
</HTML>