Loading PayPal Smart Buttons (JS SDK) with Brave Browser throws errors - paypal

I'm trying to get a basic PayPal button on my web page, but I can't even load the API without getting errors. I've asked for help on PayPal's own forum, but no one replies.
Here is my page. I'm running in sandbox mode. I've replaced the actual client ID below with [CLIENTID].
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>PayPal test</title>
</head>
<body>
<script src="https://www.paypal.com/sdk/js?debug=true&client-id=[CLIENTID]"></script>
</body>
</html>
I can add a button to the page, and make a purchase, so the buying process works. But it always throws this error at page load. I'm on Win10, Brave Browser (based on Chromium).
js?debug=true&client…ruzpDLhao-FzS6:2659 unhandled_error
{err: "Error: Invalid json: .↵ at XMLHttpRequest.<anon…[CLIENTID]:2597:55)", timestamp: "1601234382102", referer: "localhost", uid: "9b7c68f416_mtk6mtc6ntq", env: "sandbox"}
env: "sandbox"
err: "Error: Invalid json: .↵ at XMLHttpRequest.<anonymous> (https://www.paypal.com/sdk/js?debug=true&client-id=[CLIENTID]:2597:55)"
referer: "localhost"
timestamp: "1601234382102"
uid: "9b7c68f416_mtk6mtc6ntq"
__proto__: Object
===============================================================
UPDATE
Sorry, I incorrectly wrote I am on Google Chrome. I'm on Brave Browser (based on Chromium). I've tested on Google Chrome and MS Edge, and it works there. Brave is where the errors happen. I've tried to add a new sandbox app, but get the same error. I've used the Brave browser settings to allow my site all privileges, but still the same error.
Live test:
Just loading API: https://www.trainerslab.app/PayPalTest.html
Example from PayPal dev site: https://www.trainerslab.app/PayPalTest2.html
Screenshot:

Related

TestCafe Login with .httpAuth suddenly does not work anymore. Page shows html "...charset-hammerhead-shadow-ui..."

A super simple Fixture (TestCafe Script) with .httpAuth worked fine at first. Then I had a few password resets with my Windows account. And now when running the same Fixture the browser shows about 12 lines of html code:
<html><head><meta class="charset-hammerhead-shadow-ui" charset="iso-8859-1"><link rel="stylesheet" type="text/css" class="ui-stylesheet-hammerhead-shadow-ui" href="http://172.24.88.142:2346/testcafe-ui-styles.css"><script type="text/javascript" class="script-hammerhead...........etc
This is with Edge browser and also with Chrome. With IE it opens an empty page :-(
I even deleted the browser cache for Edge and IE but with no luck.
testcafe -v : 1.19.0
Edge Version 103.0.1264.44 (Official build) (64-bit)
new-fixture.testcafe.js:
fixture `New Fixture`
.page `http://my.company/path`
.httpAuth({ username: 'myusername', password: 'mypassword', domain: 'mydomain' });
test('New Test', async t => {
await t
.click('body');
});
PS:
I am new to TestCafe and TestCafe Studio and I defenitely like it!
With one of my first tests with TestCafe Studio I opened our intranet with a Codeless recording resulting in "401 UNAUTHORIZED".
So I clicked the Fixture > Edit and chose 'Basic HTTP/NTLM authentication' and entered my User name, Password and Domain.
The code worked fine for about a day!!! :-)
BUT THEN for the next two days I had several times my Windows Account LOCKED OUT. At first our IT people helped me to reset my password and then I found that I can click on "Reset password" on the login screen myself!
Anyhow, my TestCafe script does not work anymore since then, showing just the 12 lines of html code.
Please Help!

Facebook OpenGraph Issue

I have done extensive searches on the Internet for a solution to this issue, but all that I can find is always related to making timeout adjustments on a Linux machine running Apache. I am running IIS version 10 on Windows 2019 Server. When Facebook changed it's website approximately 30-days ago, the Open Graph image sharing protocol stopped working properly. An attempt to use the Facebook Developer scraper, I get the following timeout error.
Curl Timeout
The request to scrape the URL timed out.
Curl Error
Curl error: 28 (OPERATION_TIMEOUTED)
I also filed a bug report with Facebook, but they simply closed the report, stating that the problem is with my server or network connection. I opened and inspected the server's error logs, and found no issues. I then setup and inspected the IIS logs, and found that Facebook indeed hit the server properly and fetched an image and reported it back. But the timeout error still occurs and the image is not shared upon an attempt to share it. Here are the records from the IIS logs that seem to indicate that Facebook is indeed contacting my server correctly, except for the fact that they are using "http" rather than "https." This has been reported to Facebook.
2020-12-24 18:31:51 W3SVC3 EDENUSA-FS11 10.1.252.250 GET /images/qr_code/edenusa_qr_code.png - 443 - 69.171.249.113 facebookexternalhit/1.1+(+http://www.facebook.com/externalhit_uatext.php) - www.edenusa.com 200 0 0 70
2020-12-24 18:32:02 W3SVC3 EDENUSA-FS11 10.1.252.250 GET /rent-lighting/lighting/rent_lighting.asp - 443 - 69.171.249.111 facebookexternalhit/1.1+(+http://www.facebook.com/externalhit_uatext.php) - www.edenusa.com 200 0 0 21410
And following is a snippet of the required meta code in our header area, from the home page:
<!DOCTYPE html>
<head>
<title>Rent a Stage | Rent a Sound System | Rent Lighting System | Rent Up Lighting</title>
<meta prefix="fb: https://ogp.me/ns/fb#" property="fb:app_id" content="1376081292633720">
<meta property="og:url" content="https://www.edenusa.com/index.asp" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:title" content="Rent a Stage | Rent a Sound System | Rent Lighting System | Rent Up Lighting" />
<meta property="og:image" content="https://www.edenusa.com/images/homepage/compressed/indian_temple_in_chino_hills.jpg" />
<meta property="fb:app_id" content="1376081292633720" />
I've worked on this for over a week now, without resolution. Anybody else having this issue, or know of a way to resolve the timeout issue?
This issue was resolved as follows:
We had to remove REST code in the GLOBAL.ASA that goes out and fetches geographic info (City and State only) based upon the client's IP address. The service endpoint is a bit slow, and required that a longer timeout than might be considered "normal" to be used. So when this code branch was commented out, the Facebook CURL timeout error no longer occurred. We are looking at another IP geographic info service that is faster.
After completing step 1, we found that on the home page ONLY, we had to leave the INDEX.ASP portion of the URL in place. We had code the stripped the "index.asp" off the canonical URL. For unknown reason, Facebook looks at the HTTP header, sees that the original URL has the "index.asp" included, and then compares that to the URL specified in the "og:url" meta tag.
In conclusion, the most recent rollout of Facebook includes new code that configured a shorter timeout value for CURL. This caused websites out on the web with a somewhat shorter startup time, to experience this issue. So for now, the only fix is to monitor a site's startup time, and shorten it down enough for the Facebook debugger/scraper to function as it did before the most recent changes.

Beginner Bottle and static files question

After using the Python http.server module I'm now trying to convert everything to Bottle and can't even get started. My problem is locating static files - everything I've tried results in a "404" error. So I've tried to reduce everything to the simplest possible example. My top level directory is in "/home/dave/test" and under that is a single file (test.py), and a subdirectory ("/home/dave/test/static") containing the single file "index.html". The html file is pretty basic:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bottle Test</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Hello, World</h1>
</body>
</html>
If I double click on the file itself, it opens a new browser page and displays the "Hello, World" message. The test.py file is:
#!/usr/bin/env python3
from bottle import route, run, static_file
#route('/static/<filename>')
def server_static(filename):
return static_file(filename, root='/home/dave/test/static')
run(host='localhost', port=8080, debug=True)
If I open a browser window and enter "localhost:8080/index.html" I get back the "Error: 404 Not Found" message and the terminal window where I'm running the script looks like:
$ ./test.py
Bottle v0.12.16 server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.
127.0.0.1 - - [06/Apr/2019 15:31:25] "GET /index.html HTTP/1.1" 404 740
I've tried various permutations of the URL and root parameter but nothing I've tried works. Clearly I'm missing something very basic here. Can somebody tell me what is wrong in in the above files (or URL)?
Thanks,
Dave
I was able to contact the author of Bottle and he responded:
a route matches against the path-part of an HTTP request URL. In your
example, '/static/' would match requests to
http://localhost:8080/static/index.html and serve 'index.html' file
from the '/home/dave/test/static' directory.
"http://localhost:8080/index.html" does not match the route you
specified, thus the 404 error.
I tried this and it did indeed fix the problem.

.NET AdaptivePayment SDK: PaymentDetails() is throwing a ConnectionException (404)

I am calling the AdaptivePaymentService.PaymentDetails() to get the payment details for a payment, and it is throwing a ConnectionException indicating 404. In order to debug the issue, I downloaded the source for the AdaptivePayment SDK as well as the Core SDK and stepped through the code, specifically, right where the HttpRequest is executed in Paypal.HttpConnection.Execute().
It appears as if all configuration variables are being read from the web.config:
The address in the underlying httpRequest looks correct:
The payload looks correct:
However, a WebException is thrown with the following response:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /cgi-bin/ppapi was not found on this server.</p>
<p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p>
<hr>
<address>Apache Server at api.sandbox.paypal.com Port 443</address>
</body></html>
Any help would be greatly appreciated.
Since you have configured both ClientId/Secret and 3-token credentials (API username, password, signature) in your configuration, the endpoint has been detected incorrectly, giving the REST API higher preference. Please remove the client id / secret configuration and you should see the endpoint set correctly to https://svcs.sandbox.paypal.com/AdaptivePayments/PaymentDetails

Code runs fine on localhost but not on Facebook. Maybe because of CURL?

The following code gives fine output while running on localhost. Earlier it was giving some error related to CURL so i fixed it and now its running fine on localhost.
But my app is not running on facebook.I am using HEROKU so is it having same problem of CURL?? If so than how can i fix it?? I hav even uploaded PHP SDK on heroku. My IE gives error 500 and firefox gives a blank screen.
<html>
<head>
<title>Test</title>
</head>
<body>
<?php
include 'libs/facebook.php';
$facebook=new Facebook(array(
'appId'=>'************',
'secret'=>'********************',
'cookie'=>true
));
$me=null;
if($me)
{
$logoutUrl=$facebook->getLogoutUrl();
echo "<a href'$logoutUrl'>Logout</a>";
}
else
{
$loginUrl=$facebook->getLoginUrl();
echo "<a href='$loginUrl'>Login</a>";
}
?>
</body>
</html>
The code you posted will always ask for the login url because $me will always be null.
As to the rest of the errors, try adding error reporting to the top of your file
error_reporting(E_ALL);
ini_set("display_errors", 1);
Then deploy, then run heroku logs --tail locally to see what is going on in the file.
Also place your PHP section above your HTML outside the <html> tag.