Sinatra-Synchrony is causing HttpProtocolException: HTTP-headers - are expected Error for some users - ruby

I have a webapp that updates data in Pardot through one of their API's.
The webapp is coded with Sinatra. The user adds the api url and a csv file with the data that needs to be updated in a form and hits submit. The code parses the csv data and sends it to the url that was provided. The back end server is Windows Server 2008 R2 with IIS 7.5 and HeliconZoo.
Because of performance issues Helicon tech support pointed me to Sinatra::Synchrony and I decided to implement it.
I tested it on multiple different computers with different OS's and browsers and everything works good. Performance was noticeably faster when more then one computer was connected and had submitted the form.
The problem I have is that some users keep getting this error after every time they submit the form:
Error
Helicon Zoo module has caught up an error. Please see the details below.
Worker Status
%WorkerStatus%
Windows error
%WindowsError%
Internal module error
message: HTTP-headers - are expected
job: JobHttp[#3] - /
transportStatus:Online
getErrorMessage:
RAW output bytes:0
RAW output Begin
Empty stderr
End
type: ZooException
file: JobHttp.cpp
line: 266
version: 1.1.57.268
Even though they get this error the data was sent to Pardot successfully.
Here is an entry from the ZooError.log file:
[10/24/2012 10:44:01] HttpProtocolException: HTTP-headers - are expected
job: JobHttp[#212] - /
transportStatus:Online
getErrorMessage:
RAW output bytes:0
RAW output Begin
Empty stderr
End
Where do I even start to troubleshoot this error?

Neil. I'm from Helicon Tech and will try to help you.
Please check the log of your Sinatra application, as according to our logs Sinatra responded with empty response which is not good.
It can be some issue in Zoo, so if you could provide some test application and instructions on how to reproduce such behavior to our helpdesk, we would try to detect and fix it.

I want to thank Tony for offering to help but this error didn't have anything to do with Helicon Zoo. The errors that were displayed on the screen from Zoo weren't any help but this ended up being an issue with my own code.
I was sending data to Pardot that came from a csv file. The users where creating the .csv files from excel by copying from one excel sheet to the other. By doing this excel was copying a bunch of blank lines and these blank lines were then saved into the csv file.
So...once I checked for blank rows in the csv file:
if !row.empty?
I stopped getting the error.

Related

Why the HTTP Request return that the response is not in JSON format?

I built a flow that will generate an SSRS report as PDF dynamically from Dynamics by following this amazing article:
D365 Reports as PDF using Power Automate
After I have followed all the steps mentioned and performed different testing, sometimes the flow calls the API and output, as a result, the content type of the file, and sometimes it fails with the below response using the same report ID:
Inner Error returned:
""innerError": "<html><head><title>Object moved</title></head><body>\r\n<h2>Object moved to here.</h2>\r\n</body></html>\r\n"
Succeeded Run (Without any changes to the flow):
Actions scope screenshot:
-- Updated logic to handle HTTP request:
This flow really scares me as it might and might not work because I will be sending this report to our customers and I want to avoid any issue that might happen to the flow.
Kindly note that if you try to reproduce the same flow you will encounter the same issue.
Any idea what will be the workaround to handle this issue and to avoid flow failure?
Any help is highly appreciated.
I solve this issue adding "Accept: {asterik}/{asterisk}" to the Header. sometimes the request returns the redirect error in this case try to repeat the request making the same request again(using run after setting).
fix screen

MediaWiki InstantCommons file download error

My goal: I'd like to use an image from commons.mediawiki.org within a MediaWiki installation.
First I was trying to debug my InstantCommons configuration: Referring to files on commons.mediawiki.org failed for some reason. After activating various debugging options I learned that though general image download succeeded some kind of thumbnail followup request issued by the MediaWiki installation failed, which resulted into an overall error from the ForeignAPIRepo-Module.
As I can not deal with this error right now I thought I'd try something else as some kind of fallback: Download the MediaWiki image by specifiying the image URL in the upload image web page. The idea is to let MediaWiki download the image and include this image as regular wiki content. This way I would require to add license details manually and add a few comments, but this would be better than having no image.
But trying this I strangely get an error: It says "Fehler beim Senden der Anfrage" which means "Error while sending the request". But the internal request seems succeed in the logs. Here is what MediaWiki was logging:
[fileupload] Temporary file created "/tmp/URLdafce5345aa3-1"
[fileupload] Starting download from "https://upload.wikimedia.org/wikipedia/commons/c/c7/Broccoli%2C_Champignons%2C_Karotten_%2810581663524%29.jpg" <followRedirects>
[fileupload] <Error, collected 1 error(s) on the way, integer value set>
+------+---------------------------+------------------------------------------+
| 1 | http-request-error | |
+------+---------------------------+------------------------------------------+
[fileupload] Download by URL completed with HTTP status 200
Comment: All other log messages do not indicate anything that looks like an error or is related to the task of downloading the image, so I skipped them here.
The URL is correct, the image can be downloaded from the URL, MediaWiki receives a response code of 200, but instead of processing the response it indicates an error. Why? For http and https URLs I get the same result in the log.
Has anybody encountered this problem before in MediaWiki installations? Does anyone have any idea what the reason for this behaviour could be?
Comment: The wiki is of version 1.25.2 and a standard installation including SWM on an up to date standard Ubuntu Linux OS. Nothing exotic, nothing modified in any way.
Comment: Yes, I could upgrade to the latest version but, I'm not sure if this really solves the problem: I know that this featured did work in some other MediaWiki installations I have set up some time ago. Does anyone have a clue why this feature could fail here? Has anyone encountered something like this before?
Edit: I experimented with downloading from another MediaWiki instance of exactly the same version - 1.25.2 - in my local network. This did not succeed as well. But I get a different error message (translated): "The file .... could not be stored at ...". The "funny part": Though the error message indicated otherwise the file has been downloaded successfully and stored as expected. It has the correct user rights as one would expect, but log messages indicate that there are bugs in MediaWiki regarding this part: ("PHP Notice: Undefined property: UploadFromUrl::$nbytes") Maybe the uploading implementation is buggy somehow and the problems I am running into are typical?
There are multiple bugs with HTTPS support in MediaWiki, php-curl etc. See https://www.mediawiki.org/wiki/InstantCommons#HTTPS for debugging information, there is no magic bullet.

Ajax getting 412 (Precondition Failed) sometimes

I am writing a website with Struts and Tomcat as the server.
On a page there's an ajax post request using jQuery (not cross-domain). The returned value is plain html.
The problem is, I sometimes (not always, not even frequent) get 412 (Precondition Failed) error. What could be the cause of this unstable error?
I'm posting an answer because I've just had this issue today. It's obviously an update to Mod Security in my case.
I was sending data to the server via AJAX and some Javascript which was part of this message caused the 412. It turned out to be the word HTML (I was passing element.innerHTML within the code)
ModSecurity treats that as a potential threat by the looks of it. For a quick fix I replaced all HTML strings with H%T%M%L and reversed the process on the server and it's now running.
You've probably long-since solved this but posting in case it's useful for anyone else.
Just today i was facing the same problem "412 Precondition Failed".
It is a Codeigntier app that uploads audio and Image files.
Till now a lot of files uploaded through the Ajax File uploader. But today i file was not uploading and through chrome Inspect > Network i found that error 412 Precondition Failed.
I re-uploaded the file so many file by changing my ajax script multiple times.
Suddenly some special character caught my attention. I renamed the file and tried to re-upload. Trust me it worked.
Before:
AFTER:
I don't have proper explanation but it works for me.
Thanks

invalid encoding when uploading an image to rails using javascript

I'm using qqfileupload (http://valums.com/ajax-upload/) to create a single drag & drop image upload interface.
The request is being sent to rails, and my rails console is returning
!! Unexpected error while processing request: invalid %-encoding (����JFIFdd��Ducky��Adobed)
which I assume is rails attempting to read the file.
I set my controller to output
return render :text => params
thinking that I could look at what the server was recieving, but I only get the Unexpected error again, which to me says that Rails is hitting this error before getting to the controller.
The params from the javascript console shows
http://localhost:3000/users?qqfile=me.jpg&first_name=&last_name=
the first and last fields are supposed to be blanks.
I stared following this tutorial http://css-tricks.com/ajax-image-uploading/, which looked very similar to the case I was already using, and it lead to this download script http://valums.com/ajax-upload/, which is almost identical to the one I had before, but somehow is slightly different and doesn't return the error above.
Hopefully this helps somebody out.

ABCPdf - Unable to render HTML. Unable to load page

I'm using ABCPdf to convert HTML to a PDF. I'm using the method:
AddImageUrl()
This works fine in Dev and UAT, but on Production I continuously get the message:
Unable to render HTML. Unable to load
page
Anyone see this before? Need more info?
-Ev
I guess you are tying to do URL->pdf generation. It is difficult to directly to do URL->pdf conversion. We ended up URL-Save HTML in local folder ->read HTML and convert to PDF-> delete HTML file from folder - tricky approach but it works. The only flaw is that you need to give read/write permission on a folder on server. Its still better than decreasing security settings.
have you take a look at this http://www.itjungles.com/dotnet/abc2pdf-unable-to-render-html
The default timeout for abcpdf is 15 seconds. If the page is taking longer than 15 seconds, you will get this exception.
Add the line below just after object creation of the document to resolve the issue.
theDoc.XHtmlOptions.Timeout = 10000000;
I found by working backwards (removing elements) from a target html page that omitting the tag (of all things) created this error. also, calling localhost in the target url generated this error.
I have no idea what caused this error, but I stopped the scheduled task that was running, then restarted it and it's worked fnie ever since.

Resources