Oracle Apex calling external api in dynamic action Javascript code failing - oracle

I have a dynamic action that is executing a javascript function. The function is reached ok but as soon as I try to fetch the api data it fails with TypeError: Failed to fetch.
The API is set to allow all origins and is also working when called from console or any other method.
Is there something in APEX that is blocking my calls to the external api? I have also added ACL just in case that was causing the issue but it still fails.
We are using Oracle 19 and Apex 22.1.
The call should return JSON and then I should be able to use the JSON to get the path to a report. The call fails and does not reach the external server. When looking at the error I can also see
TypeError: Cannot read properties of undefined (reading 'requestContent')
Any ideas would be appreciated.

I have changed the call to a jQuery ajax call with success callback and this is working.
I also found that the ACL was not set with the correct principal. I used the schema but it was actually a user in apex that seemed to work.

Related

Apache NiFi - 'unexpected end of stream' error

When I call NiFi's API (/flow/about), I get 'unexpected end of stream on' .. in invokehttp.java.exception.message flow file's attribute after it passes from InvokeHTTP processor. (NiFi v1.19.1 running on Linux VM).
Other API tools are also failing when I call NiFi's API.
I would like to use NiFi API, but I suspect that something is not working properly in this version.
(Examples: (1) HTTP GET to google.com is working properly, (2) I receive some raw content from the browser when I call http://localhost:8443/nifi/flow/about)
Could you please advise?
Thank you.
Update #20230130#1
Some errors in nifi-user.log:
No errors in nifi-app logs:
Meanwhile, I learned that in order to make any calls to NiFi by Rest API, I have to use a token for access (before of this I supposed that this is optional).
I was able to get the token and use it in subsequent calls to "nifi-api".
I'm expecting that the same procedure is going to work also in the latest NiFi version (current procedure was tested with NiFi 1.16.3).

Got "parsererror" when trying to using Ajax call REST Service

I have been puzzled by this question for almost a week and still not able to get it solved.
The problem is while using JS Ajax calling a REST GET method, but I always got
parser error
However it's working fine for Firefox's REST Client
Check the Code here.
The URL http://wally.pythonanywhere.com/test/ is not producing a valid JSONP. Valid JSONP response should look like your json data wrapped in a function invocation. Visit JSONP doc for more details.
The actual error your code facing is "jQuery18308228800671640784_1374132969407 was not called". This is because of the invalid JSONP response.

Codeigniter global error override

Is there a way in Codeigniter to override global errors. For instance if an DB error or PHP critical occurs it wont show the error itself but something like 'Our admin guy is fixing the issue' and the error is just logged and emailed.
Codeigniter lets you handle error messages your way, depending on the HTTP status.
Refer to this documentation on error handling
In addition to #Pos5e5s3dFr3ak's answer, you should handle as many errors as you can manually. For example, if you have a database error, your code should acknowledge (or 'catch') it and perhaps load the appropriate view, or pass it onto a library that will log an email the fault, instead of displaying the intended result.
This method can be used as an alternative, or as an addition to the original answer - sometimes you need not locate the error just by its HTTP response Status Code.
As an example, you may find that the database engine in use is down. If this is the case (you would have to determine if it is indeed down - ie. you are not getting the desired response), you would pass the user on to example.com/error/database, for example.

How to debug a failed ajax request in google chrome?

I have a web application that crashes on ajax requests with google chrome (it works with every other web browser it was tested it). After debugging I found that the error is caused by response.responseText being undefined. The xhr object looks like this:
argument: undefined
isAbort: false
isTimeout: undefined
status: 0
statusText: "communication failure"
tId: 3
In debugger in the 'network' tab I get "(failed)", however all the headers are there and I can even copy into clipboard the response body (which is a valid JSON).
My question is - how can I debug this problem? Where to find additional information, what causes this request to fail?
I finally found the solution to my problem : AdBlocks, when it blocks an ajax request, it just says "communication failure".
The first thing I would double-check is that the data coming back from the response is valid JSON. Just pass it through a JSON validator like this online JSONLint: http://jsonlint.com/
I assume that you are using something like jQuery to make your AJAX requests. If so, then make sure that you are using the development version of that library. Now that you are using the development version (uncompressed) of the script, find the particular function that you are using (eg. $.ajax) and then, within the Chrome inspector, insert a breakpoint in the code where the AJAX response is first handled (eg. https://github.com/jquery/jquery/blob/master/src/ajax.js#L579). Then proceed to step through the code, inspecting various return-values to see exactly what is going wrong.
If you are not using something like jQuery to make AJAX calls, then I'd recommend using a framework to avoid possible cross-browser compatibility issues like you might be experiencing right now.

Google AJAX API loader returning null

We have been using google AJAX API loader (to get the location of a client based on her IP) as described here:
code.google.com/apis/ajax/documentation/#ClientLocation
Earlier when the API loader was included in any file
then
it used to populate the google.loader.ClientLocation property with data about the client
but two days back i found that it is returning null.
Any help is appreciated
Well.. the reason i found is that the API is not able to resolve my IP. I don't know why...
I found it to be working fine with other IPs.

Resources