Google Analytics API request returns captcha? - google-api

Since yesterday, our connection to the Google Analytics API returns an HTML page with... captcha. Does anyone experience something like this?
We use the API with the PHP library. Our code for retrieving a report (its wrapped in our own class but it uses the google/apiclient package):
// Create analytics
$this->analytics = new \Google_Service_AnalyticsReporting($this->client);
// Create the ReportRequest object.
$request = new \Google_Service_AnalyticsReporting_ReportRequest();
$request->setViewId($view_id);
$request->setDateRanges($this->dateRanges);
$request->setMetrics( array_values( $this->metrics ) );
$request->setDimensions( array_values( $this->dimensions ) );
$request->setSegments($this->segments);
$body = new \Google_Service_AnalyticsReporting_GetReportsRequest();
$body->setReportRequests( array( $request) );
try {
$reports = $this->analytics->reports->batchGet( $body );
}
catch(\Google_Service_Exception $e)
{
echo"Error (1)...\n";
echo $e->getMessage() . "\n";
$this->lastError = json_decode($e->getMessage());
return false;
}
We catch a Google Service Exception, and the message of the error is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta name="viewport" content="initial-scale=1"><title>https://analyticsreporting.googleapis.com/v4/reports:batchGet</title></head>
<body style="font-family: arial, sans-serif; background-color: #fff; color: #000; padding:20px; font-size:18px;" onload="e=document.getElementById('captcha');if(e){e.focus();}">
<div style="max-width:400px;">
<hr noshade size="1" style="color:#ccc; background-color:#ccc;"><br>
<form id="captcha-form" action="index" method="post">
To continue, please type the characters below:<br><br>
<img src="/sorry/image?id=14645528721876966739&q=EgSIkL9bGIjOzu4FIhkA8aeDSycUmKeaKy3bPExiN-Ol2PpxQzOfMgFj&hl=en&continue=https://analyticsreporting.googleapis.com/v4/reports:batchGet" border="1" alt="Please enable images"><br><br>
<input type="text" name="captcha" value="" id="captcha" size="12" style="font-size:16px; padding:3px 0 3px 5px; margin-left:0px;"><br><br><br>
<input type="submit" name="btn-submit" value="Submit" style="font-size:18px; padding:4px 0;">
<input type='hidden' name='q' value='EgSIkL9bGIjOzu4FIhkA8aeDSycUmKeaKy3bPExiN-Ol2PpxQzOfMgFj'><input type="hidden" name="continue" value="https://analyticsreporting.googleapis.com/v4/reports:batchGet">
</form>
<hr noshade size="1" style="color:#ccc; background-color:#ccc;">
<div style="font-size:13px;">
<b>About this page</b><br><br>
Our systems have detected unusual traffic from your computer network. This page checks to see if it's really you sending the requests, and not a robot. Why did this happen?<br><br>
<div id="infoDiv" style="display:none; background-color:#eee; padding:10px; margin:0 0 15px 0; line-height:1.4em;">
This page appears when Google automatically detects requests coming from your computer network which appear to be in violation of the Terms of Service. The block will expire shortly after those requests stop. In the meantime, solving the above CAPTCHA will let you continue to use our services.<br><br>This traffic may have been sent by malicious software, a browser plug-in, or a script that sends automated requests. If you share your network connection, ask your administrator for help — a different computer using the same IP address may be responsible. Learn more<br><br>Sometimes you may be asked to solve the CAPTCHA if you are using advanced terms that robots are known to use, or sending requests very quickly.
</div>
IP address: xxx.xxx.xxx.xxx<br>Time: 2019-11-19T08:25:44Z<br>URL: https://analyticsreporting.googleapis.com/v4/reports:batchGet<br>
</div>
</div>
</body>
</html>
If anyone experiences this too or has a solution, please let me know.
Thanks in advance.

This may have been Google applying some safety measures to handle a large spike in traffic. I am also aware they updated their error messages for the API as of the 4th November 2019 which may be why we are now getting this error instead of something else previously.
Email I received from Google:
"we’re upgrading the Google Analytics APIs to a new technical infrastructure stack beginning November 4, 2019. As a result of this change, clients will see some differences in the response error message text for failed API requests."
"If your application or log analysis workflow rely on the specific wording provided in responses of the Management API v3 or Core Reporting API v3, you will need to update the code to reflect the new error response text. Please note that as exact error message wording can change at any time, we strongly discourage hardcoding the specific message text when processing responses from the API."
Today my requests failed and a captcha image was provided in my error log that produced a 404.
Error I received:
"Our systems have detected unusual traffic from your computer network. This page checks to see if it's really you sending the requests, and not a robot."
"The block will expire shortly after those requests stop. In the meantime, solving the above CAPTCHA will let you continue to use our services."
I have since found the service to be back running in small doses without any code changes required.
I suggest to try again and limit the number of requests until the service is back 100%.

Related

Web Chat did not display the result

Currently, I had developed Microsoft Graph ChatBot which retrieves the data from SharePoint but when I debug in Emulator its work, but I deploy in WebChat the result did not display.
The results from Emulator,
The results from WebChat
Anyone know how to solve it or suggestion?
There are currently two versions of Web Chat: Gemini and Scorpio. Test in Web Chat is still using the older version - Scorpio - which unfortunately does not support OAuth Cards. The BotFramework Development Team is working to update Test in Web Chat, but if you need an immediate fix, I would recommend creating your own web page that uses the latest version of Web Chat. Take a look at the sample code below.
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>WebChat</title>
<script src="https://cdn.botframework.com/botframework-webchat/master/webchat.js"></script>
<style>
html, body { height: 100% }
body {
margin: 0;
}
#webchat {
height: 100%;
}
</style>
</head>
<body>
<div id="webchat" role="main"></div>
<script>
(async function() {
// Note, for the simplicity of this example, we are simply using the Web Chat Secret here;
// however, it is recommended that you create a backend REST API to generate and manage
// tokens for production.
window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ secret: '<WEB_CHAT_SECRET>'}),
}, document.getElementById('webchat'));
})().catch(err => console.log(err));
</script>
</body>
For more examples of how to get started with Web Chat, take a look at the Web Chat samples.
Hope this helps!

Check if Resource Exists in Polymer Framework

I am trying to pull in product images in a dom-repeat template, but am getting 404 errors for missing resources showing up in the console.log. I would like to clean up the log with more legitimate errors.
<template is="dom-repeat" items="" index-as="index">
<lazy-image class="center"
placeholder="/images/placeholder.png"
src="https://www.images.com/[[formatImg(item.id)]].png"
style="width: 24pt; height: 24pt;">
</lazy-image>
</template>
...
formatImg(id) {
if(typeof id != 'null') return id.replace(' ', '%20');
}
I've seen some documentation on on-error events, but am not seeing a straight forward path to implement them into the Polymer framework.
Is there a way to handle these GET requests so they don't get logged?
Short answer:
Sadly, no.
It's not a "can't do it in Polymer" thing. At the time of writing, handling 404s to prevent a console error is not possible at all from the developer's point of view.
Longer answer:
AFAICT there is no way for a web developer to prevent a 404 from being logged by a browser as an error. If a browser is asked "get this thing please" or even "hey can you check if this is a thing?" and the answer is "that's not a thing", it is up to the browser what it does with that information. Right now, what it does (welp, Chrome anyway - I haven't researched what the others do) is "log an error to the console". Always. No matter what.
You can (as the end user) turn that behavior off in your browser. But you can NOT (as a developer) "catch" the error and handle it to keep the browser happy. Even if you DO handle the error and give the browser something that exists instead of the 404-causing resource, it will STILL be logged in the console as an error:
<!-- STILL CAUSES A 404 ERROR TO BE LOGGED TO THE CONSOLE -->
<img id="myimg" src="imagethatdoesntexist.gif" onerror="this.onerror=null;this.src='imagethatexists.gif';">
Source: Trial and error && this thread https://bugs.chromium.org/p/chromium/issues/detail?id=124534#c17

FineUploader 3.6.0 object File is not a File or INPUT element Ignoring

I am trying to integrate fine uploader into my hybrid mobile app (using Icenium). I have all the files needed and the uploader runs perfectly when I'm running the app in the simulator. When I run my app on my iphone I get the [FineUploader 3.6.0] [object File] is not a File or INPUT element! Ignoring!. I can't for the life of me figure out why I would be getting this.
This is my config...
$(document).ready(function() {
$('#fineUploader').fineUploader({
request: {
endpoint: 'uploadurl'
}
});
});
I have navigated to the demo page for the jquery wrapper which uses the previous config and the demo runs fine. Any ideas? I'm not sure how to debug this any further.
Thanks
EDIT:
View -
<div data-role="view" id="queue-view" data-title="Queue" data-show="app.queueView.show" data-transition="slide:left" style="display: none;">
<header data-role="header">
<div data-role="navbar">
<a data-align="left" data-icon="menuicon" data-role="button" data-click="app.applicationLayout.onMenuClick"></a>
<span data-role="view-title"></span>
</div>
</header>
<button id="filesButton">Add Files</button>
<div id="fineUploader" class="upload-cont">
</div>
<div id="fineUploader2" class="upload-cont">
</div>
<input id="cameraButton" type="file" name="camera" accept="image/*;capture=camera">
</div>
ViewModel (app.queueView.show) -
$('#fineUploader').fineUploader({
request: {
endpoint: 'uploadurl'
}
});
I have also tried the direct from camera code which simply gives me undefined errors. That's why there is an extra fineUPloader2 and the cameraButton. I have tried a lot of things and all seem to result in either undefined errors or the No files error.
I'm also using require.js to bring in my javascript files (which I have many since I have set my project up using MVVM).
Thanks
Your issue was caused by a bug in Fine Uploader that appeared only when File objects are created in a frame/window/context other than the frame/window/context where the uploader instance was created. There are a couple issues filed here. Yours, (#870) and another, similar issue (#866). The issue was caused by the use of instanceof to determine if an object was a File. Both cited issues have been fixed in the associated hotfix branch in the Github project. I plan on pushing out a 3.6.1 hotfix release with these fixes in the next 24 hours or so.

Wicket Modal Windows empty if behind Proxy

Hi all you genius people!
Has anybody ever had a problem with modal window's content when using the web site from behind a proxy? Sadly I cannot provide any details about the proxy configuration. (It's the proxy of a foreign company.)
I can tell you though that it is a Squid proxy and that there are no explicit error's in Wicket's ajax debug windows or the server log. Proxy admin also says there's nothing blockek in the logs. Wicket actually returns an empty div to be displayed in the modal window's content:
<div id="contentd" style="display:none"></div>
This is what is returned when I do not have the proxy between me and wicket:
<div id="content10">
<form>
<table align="center" cellspacing="5px" width="100%">
<tr>
<td colspan="2" align="center">
<span><p>Möchten Sie den Monitor wirklich löschen?</p></span>
</td>
</tr>
<tr>
<td align="center">
<input type="button" value="Ok" class="button" id="confirm15" onclick="var wcall=wicketAjaxGet('?wicket:interface=:1:uniModal:content:confirm::IBehaviorListener:0:-1',function() { }.bind(this),function() { }.bind(this), function() {return Wicket.$('confirm15') != null;}.bind(this));return !wcall;">
</td>
<td align="center">
<input type="button" value="Abbrechen" class="button" id="confirmNot16" onclick="var wcall=wicketAjaxGet('?wicket:interface=:1:uniModal:content:confirmNot::IBehaviorListener:0:-1',function() { }.bind(this),function() { }.bind(this), function() {return Wicket.$('confirmNot16') != null;}.bind(this));return !wcall;">
</td>
</tr>
</table>
</form>
</div>
(Sry for this horribly dirty html code, not a work of mine. ^^)
My guess is that the proxy captures parameter's that should arrive at wicket but never do. I switched on DEBUG for org.apache.wicket but can't find anything that might seem useful. Does anybody know an instant solution or have any ideas how to look into this further? After DEBUG logging showed nothing I pretty much ran out of ideas.
Maybe someone can read something out of the wicket logs:
Working without proxy - http://pastebin.com/Agi2JMJM
Not working with proxy - http://pastebin.com/hfzXDHtq
Thanks in advance!
The actual solution was quite easy, now that I know the details. Wicket uses two custom headers when handling modal windows:
wicket-ajax
wicket-focusedelementid
Without these headers wicket seems to be unable to identify the correct modal frame object or similar. The company's proxy server blocked all non-whitelisted headers. After tweaking the proxy server to allow the headers above everything worked like a charm.

How do you suppress script errors in HTAs?

I have an HTA that loads up an external webpage inside a nested IFRAME. This webpage (which I don't have control over) throws an "Access Denied" error in my HTA asking the user if they "want to continue running scripts on this page". What I want to do is have my HTA suppress all scripting error messages regardless of where they originate
Here's a very basic idea of how my setup is working:
<html>
<head><HTA:APPLICATION ... ... </head>
<body>
...
<div id="navigation">...</div>
<div id="browsers">
<iframe APPLICATION="yes" src="http://myserver/browse.php?src=http://www.example.com/">
<!-- contents of http://myserver/browse.php?src=http://www.example.com/ -->
<html>...
<body>
<div id="titlebar">...</div>
<iframe APPLICATION="no" src="http://www.example.com/">
<!-- contents of http://www.example.com/ with js that causes error -->
</iframe>
</body>
</html>
</iframe>
<iframe APPICATION="yes" src="http://myserver/browse.php?src=somethingelese"></iframe>
</div>
</body>
</html>
And here is a screenshot of the error:
As far as I know there isn't a way to suppress errors like that. If you have access to their registry or group policy here is the relevant Registry Value (for IE naturally) that disables that popup:
Key: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
Name: Disable Script Debugger
Type: REG_SZ
Value: no
A sentinent GetWindowText() -> SendMessage WM_CLOSE based dialog closer could deal with that but is not exactly disabling
I've been searching for days and haven't found solid solution - perhaps HTAs do not serve their simplistic rationale after all, at least when using actual browser info
By the way changing the IE8 script debugger does not disable the error message - it merely disables the debug dialog and replaces it with a script error
Unchecking the IE flag "Error Dlg Displayed On Every Error" does not alleviate the issue either

Resources