I am trying to read the request body in a custom plugin by following this url
local data = kong.request.get_body()
if data then
kong.log(data)
end
I am getting the following error
2019/03/14 21:57:55 [error] 14039#0: *45 lua entry thread aborted: runtime error: /usr/local/share/lua/5.1/kong/pdk/private/phases.lua:66: no phase in kong.ctx.core.phase
stack traceback:
coroutine 0:
[C]: in function 'error'
/usr/local/share/lua/5.1/kong/pdk/private/phases.lua:66: in function 'check_phase'
/usr/local/share/lua/5.1/kong/pdk/request.lua:594: in function 'get_body'
.../Apps/troop/kong/plugins/customlog/handler.lua:72: in function <.../Apps/troop/kong/plugins/customlog/handler.lua:62>, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:8000
Can anyone help me understand the problem here? I need to log the request body in my plugin.
Can anyone help me understand the problem here?
I need to log the request body in my plugin.
That call can only be called in the "rewrite, access or admin_api" phase.
Looking at your log output, the context you're trying to call it is ngx.timer, which is not even wrapped by Kong as one of its contexts. (More on that here)
What you could do is call "kong.request.get_body()" in a phase that can call it, store it in a temp var (using "kong.ctx.plugin" object), and then use it in the "log" phase for said plugin.
Related
I have created a logic app to receive an http request and validate the content which is fine. But when I receive the 400 error message, it said only that it was expecting an integer but received a string for example. I would like to add the name of the field that generates the error is it possible?
postman response
I added an http response to be executed when the requst fails but it's never triggered.
logic flow
You can assign http response to a variable and then you can check which filed is causing error.
I have reproduced issue from my side and below are steps I followed,
Initially created logic app as shown below,
Payload of http trigger is,
Logic app trigger is enabled with schema validation,
I have tried to run trigger with below payload,
{
"number":1600,
"street_name":"pennsylvania",
"street_type":7
}
Got error "Failed to start a run of logic app alertschlapp. The input body for trigger 'manual' of type 'Request' did not match its schema definition. Error details: 'Invalid type. Expected String but got Integer.'."
Next modified logic app as shown below,
Added three initialize variables action for number, street_name and street_type
number:
street_name:
street_type:
Ran the logic app with below payload,
"number":1600,
"street_name":"pennsylvania",
"street_type":7
Logic app failed with below error,
In this way, you can find out which field value is causing issue.
I apologize for my being little more han a newbie in WP and ajax but I need your help. I'm not sure if it's a bug or it's simply me who cannot manage to find a solution.
I've the following situation.
I've a plugin that displays certain data from a remote mysql server. This data need to be updated periodically.
At the moment I've implemented this through AJAX, more or less, like this:
$.ajax({
type : "POST",
url: cktn_ajax_object.ajax_url,
data: params,
dataType: "json",
success: function(response) {
<< Update UI according to response >>
},
error: function(request, status, err) {
console.debug("[AjaxOnTimer Error] status: " + status);
}
});
where $.ajax is calling the relevant php script responsible for retrieving the remote mysql data. The PHP script duration is variable, according to the amount of data it fetches (Let's say, something between a few seconds and four or five minutes).
If I test the whole on my local machine, there is no problem. The ajax call duly and patiently awaits the (slow) response of the local PHP server (which is querying the remote mysql server) and eventually, upon completion, it updates my UI.
On the other hand, when I install my plugin on the production machine things don't work as expected. Just a few seconds after having placed my ajax call to the PHP server, I get the following error in the console of the browser:
Failed to load resource: connection lost. ---> admin-ajax.php
and my script fails leaving me no other clue than the word error in the 'status' parameter of the ajax call.
Apparently the heartbeat.lock-post is interfering with my ajax call.
Any idea of what am I doing wrong?
Add the following to functions.php to turn off heartbeat:
add_action( 'init', 'my_deregister_heartbeat', 1 );
function my_deregister_heartbeat() {
global $pagenow;
if ( 'post.php' != $pagenow && 'post-new.php' != $pagenow )
wp_deregister_script('heartbeat');
}
And restart the apache.
Not sure if your problem is solved. But if someone experience the same problem today, i've solved this using the Heartbeat Control plugin available here: https://wordpress.org/plugins/heartbeat-control/.
when i request multiple request to my web service , i received
this error
* Terminating app due to uncaught exception 'NSGenericException', reason: '* Collection <__NSCFDictionary: 0x8a32310> was mutated
while being enumerated.'
* First throw call stack: (0x1b02052 0x1f95d0a 0x1b01c21 0x5a38c 0x5342b 0x53b1a 0x53baa 0x13534e6 0x1353457 0x9b455ed9 0x9b4596de)
I think this is releated "singleton RKObjectManager" in RestKit when it receives multiple responses from web service. But i can't find solution for it.
Please help me solve this problem. Thanks advatange!
I had the same issue and it turned out I was mutating mappings while parsing objects. For more info checkout the comment on this github issue:
https://github.com/RestKit/RestKit/issues/345#issuecomment-8072999
I am getting the following error when I try to update or add contents to alfresco via drupal.
Notice: Undefined index: workspace://SpacesStore/2e3ea968-07ec-48c8-8295-80bfbef554d6 in CMISService->getLink() (line 421 of /home/drupal/myra/sites/all/modules/contrib/cmis/cmis_common/lib/cmis_repository_wrapper.php).
HTTP call to [http://myra-dev-repo.bmi.utah.edu:80/alfresco/service/cmis/s/workspace:SpacesStore/i/2e3ea968-07ec-48c8-8295-80bfbef554d6/content] returned [500]. Response: Web Script Status 500 - Internal Error Web Script Status 500 - Internal Error The Web Script /alfresco/service/cmis/s/workspace:SpacesStore/i/2e3ea968-07ec-48c8-8295-80bfbef554d6/content has responded with a status of 500 - Internal Error. 500 Description: An error inside the HTTP server which prevented it from fulfilling the request. Message:11212017 Failed to execute transaction-level behaviour
I understand that the problem is with the getLink() method which is returning an index of the workspace where the data needs to be saved.But I am unable to figure out where the change has to be made.Moreover this is a new error that has popped up recently.I remember not changing/updating anything : - ( drupal or alfresco setup) that was working just fine.
Please let me know what is going wrong.Thanks.
This problem arises only if the permissions are messed up within the server.So proper attention needs to be paid to, when the content is edited/added/modified etc
I get this error:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
root cause
java.lang.NullPointerException
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1-b24 logs.
GlassFish Server Open Source Edition 3.1-b24
when I try to forward from a jsp to another jsp or when I forward in a servlet... The thing is that Y modify some datils from my page and I want to go back to the login-page and log in again to see if the update was successful !... Any ideas on this error ?... Thankx
A NullPointerException is a rather trivial exception and has actually nothing to do with JSP/Servlets, but with basic Java in general (look, it's an exception of java.lang package, not of javax.servlet package). It just means that some object is null while your code is trying to access/invoke it using the period . operator.
Something like:
SomeObject someObject = null;
someObject.doSomething(); // NullPointerException!
The 1st line of the stacktrace tells you in detail all about the class name, method name and line number where it occurred.
Fixing it is relatively easy. Just make sure that it's not null or bypass the access altogether. You should rather concentrate on why it is null and/or why your code is trying to deal with null.