receiving parameter post_data with dbr.http.post results in 500 error

(9 posts) (3 voices)

Tags:

No tags yet.

  1. Rbert, Member

    Hello,

    I'm trying to make a http POST request, and receive the result into another report. This is my code:


    select 'dbr.http.option', 'curl', 'CURLOPT_HTTPHEADER', 'accept: */*';
    select 'dbr.http.option', 'curl', 'CURLOPT_HTTPHEADER', 'Content-Type: application/json';
    select 'dbr.report', 'sp_DBR_sync_sling_shifts', 'inPostJson=post_data','inParamJson=p_json';
    select 'dbr.http.post', @token_url, @user as "email", @password as "password", json_object('stage', 'got_token') as p_json;

    But I get a 500 server error when I open the report. What's causing this? If I don't try to call the report with "dbr.report", the result of the request is shown in the report, and if I don't try to pass "post_data" into "sp_DBR_sync_sling_shifts" but still call it, there is no problem. So the issue is that i'm unable to pass in post_data.

    Note that the returned data of the POST request is pretty large.

    How can I fix this?

  2. Rbert, Member

    I am now sure that the returned JSON is too large to use in the URL. However, I tried using "http_method=post" in the "dbr.report" call, but it seems like it has no effect.

  3. myDBR Team, Key Master

    Can you try with the latest build?

    --
    myDBR Team

  4. Rbert, Member

    Hello,

    It does not work using the latest build, same problem.

  5. myDBR Team, Key Master

    Hi,
    The code above should work. Can you check the web server error log he cause for the error 500. Applications usually do not trigger error 500. The log might reveal something bout the server config.

    You can also try without the dbr.http.options.

    myDBR Team

  6. maron, Member

    This is the error we are getting:

    ==> error.log <== [Mon Jun 19 13:51:35.206420 2023] [proxy_fcgi:error] [pid 2647263:tid 281473147982224] [client hidden:0] Premature end of script headers: report.php, referer: https://hidden [Mon Jun 19 13:51:35.206507 2023] [proxy_fcgi:error] [pid 2647263:tid 281473147982224] [client hidden:0] AH01070: Error parsing script headers, referer: https://hidden [Mon Jun 19 13:51:35.206513 2023] [proxy_fcgi:error] [pid 2647263:tid 281473147982224] (22)Invalid argument: [client hidden:0] AH01075: Error dispatching request to : , referer: https://hidden

    ==> other_vhosts_access.log <== https backend.aha.is:80 178.19.53.186 - - [19/Jun/2023:13:51:33 +0000] "GET /hidden/report.php?r=810&m=1&h=hidden&i=1 HTTP/1.1" 500 214 "https://hidden" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"

  7. myDBR Team, Key Master

    You are most likely hitting limits for your server when the dbr.http.post is so large it execeeds the server limits.

    We've introduced a new command dbr.http.save which you can use to temporarily to save the HTTP POST/GET result data prior calling the linked report:

    select 'dbr.http.save', 'sp_http_save', @inLogin, @ID;
    select 'dbr.report', 'sp_DBR_sync_sling_shifts', 'inPostJson=post_data';
    select 'dbr.http.post', @token_url, @user as "email", @password as "password";

    --
    myDBR Team

  8. maron, Member

    This works well thank you.

    Could we access the response headers in some way?

  9. myDBR Team, Key Master

    Could we access the response headers in some way?

    Sure, why not. We've added dbr.http.header commnd for this.

    --
    myDBR Team


Reply

You must log in to post.