Connect to bolt server failed - neo4j

When I try to run the simplest html page that will show me graph of neo4j data, using neovis.js:
<html>
<head>
<title>DataViz</title>
<style type="text/css">
#viz {
width: 900px;
height: 700px;
}
</style>
<script src="https://cdn.neo4jlabs.com/neovis.js/v1.0.0/neovis.js"></script>
</head>
<script>
function draw() {
let config = {
container_id: "viz",
server_url: "bolt://54.210.87.221:32953",
server_user: "neo4j",
server_password: "cents-propeller-slits",
labels: {
"Application": {
caption: "name",
size: "pagerank",
community: "community"
}
},
relationships: {
"DEPENDS_ON":{
caption: false,
thickness: "weight"
}
},
initial_cypher: "MATCH p=(Application)-[r:DEPENDS_ON]->() RETURN p LIMIT 25"
};
let viz = new NeoVis.default(config);
viz.render();
}
</script>
<body onload="draw()">
<div id="viz"></div>
</body>
</html>
I get this error message at the console:
"WebSocket connection failure. Due to security constraints in your web
browser, the reason for the failure is not available to this Neo4j
Driver. Please use your browsers development console to determine the
root cause of the failure. Common reasons include the database being
unavailable, using the wrong connection URL or temporary network
problems. If you have enabled encryption, ensure your browser is
configured to trust the certificate Neo4j is configured to use.
WebSocket readyState is: 3"
I saw the answer in https://neo4j.com/developer/kb/explanation-of-error-websocket-connection-failure/
But I didn't understood where I suppose to do the change, specially when I do not have any Neo4j files or configurations on my computer (Windows).
Why can't I connect to the bolt server like I saw in the guides?

Like the link said, you need to tell Neo4j to listen on the network.
For this you need to change the Neo4j configuration by enabeling the line dbms.connector.bolt.address=0.0.0.0:7687 in the $NEO4J_HOME/conf/neo4j.conf.
So in your case you need to do that on your server 54.210.87.221, not on your local laptop.
Cheers.

Related

Is there a way to set up electron-builder auto-updater to check for updates from Google Cloud Storage?

I would like to use the autoUpdater from electron-builder to update my apps. I'm not using Github Releases because I have a private repo and don't want to include the GH_TOKEN for security purposes. Instead I want to put the binaries and the latest.yml/latest-mac.yml files into a Google Storage Bucket.
I know that it is possible to use a generic provider to check for updates. But currently, I can't get electron-builder to even read the latest.yml. I've poured over the documentation and other github/stack overflow issues for hours and hours and haven't found anything to resolve this.
Here's the code I have in my main.js for electron/auto updater to set a new feed URL -
const data = {
provider: 'generic',
url: 'https://storage.cloud.google.com/my-project', //'my-project' is the name of the bucket
channel: 'latest',
};
autoUpdater.setFeedURL(data);
autoUpdater.autoDownload = false;
autoUpdater.checkForUpdates();
The built app plus the yml files are in that bucket. When I try to run my app, I get a huge error that basically just copies over the Google Cloud Storage HTML/CSS instead of reading and processing the latest.yml file...
Error: Error: Cannot parse update info from latest-mac.yml in the latest release artifacts (https://storage.cloud.google.com/my-project/latest-mac.yml?noCache=1dh4pdr5e): YAMLException: end of the stream or a document separator is expected at line 11, column 14:
font-family: 'Open Sans';
^
at generateError (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:167:10)
at throwError (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:173:9)
at readDocument (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1539:5)
at loadDocuments (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1575:5)
at load (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1596:19)
at safeLoad (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1618:10)
at parseUpdateInfo (/Users/somelocation/documents/some-project/node_modules/electron-updater/out/providers/Provider.js:131:37)
at GenericProvider.getLatestVersion (/Users/somelocation/documents/some-project/node_modules/electron-updater/out/providers/GenericProvider.js:57:48)
at processTicksAndRejections (internal/process/task_queues.js:86:5)
at async MacUpdater.getUpdateInfoAndProvider (/Users/somelocation/documents/some-project/node_modules/electron-updater/out/AppUpdater.js:488:13), rawData:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=300, initial-scale=1" name="viewport">
<meta name="google-site-verification" content="LrdTUW9psUAMbh4Ia074-BPEVmcpBxF6Gwf0MSgQXZs">
<title>Sign in - Google Accounts</title>
Is it possible at all to read the files from a Google Cloud Storage bucket rather than S3 or Github? Also, I've already tried eliminating an extra lines or tabs from the yml file.
You should use GCP API instead of a browser URL.
This code worked for me:
"publish": {
"provider": "generic",
"url": "https://storage.googleapis.com/YOUR_BUCKET/"
}
https://cloud.google.com/storage/docs/json_api/v1 also can be used, but it requires OAuth
try to execute this code after the app 'ready' event.
app.on('ready', () => {
const feedURL = 'https://storage.cloud.google.com/my-project';
autoUpdater.setFeedURL(feedURL);
autoUpdater.checkForUpdates();
});

NativeScript, WebView show local HTML file if offline

In NativeScript how do I show a local HTML file if the WebView is offline.
In this example I try to load a string instead of a file. But I can't get this to work ether.
let errorHtml = `
<html>
<style>
body {
background-color: red;
color: #fff;
}
</style>
<body>
<h1>Error</h1>
</body>
</html>
`;
webView.on(webViewModule.WebView.loadFinishedEvent, (args) => {
if (!args.error) {
loadLanguagesInWebView();
listenLangWebViewEvents();
} else {
webView.src = errorHtml;
}
});
webView.src = "www.google.com";
If you have included HTML files locally within your app, you don't have to worry whether the device is offline.
If you are asking about loading a remote website when device is offline, then it has nothing to do with the WebView.
It's all you have to do with your web app, implement Service Worker API. I use Angular for my web apps, all I had do was to enable the service worker module to get offline support for my web app. Depending on your web app's tech stack, you might have to do similar adjustments.

Cannot login to yammer using yam.connect.logonButton in IE11

Trying to login using yam.connect.loginButton, works fine on firefox and chrome but not on IE (I am using IE11). The response has an auth but no user object. Or sometimes the popup window doesn't close and the callback is never called. Code I used is below:
<html>
<head>
<script id="yammer-js-include" data-app-id="APP-CLIENT-ID-GOES-HERE" src="https://assets.yammer.com/assets/platform_js_sdk.js"></script>
</head>
<body>
<span id="yammer-login"></span>
<script>
yam.connect.loginButton('#yammer-login',
function (response) {
console.dir(response);
document.getElementById('yammer-login').innerHTML = 'user ' + (typeof response.user !== 'undefined' ? 'exists in response' : 'is missing!');
}
);
</script>
</body>
</html>
You mention that was the code you used, but did you replace the data-app-id with the one provided from your app on https://yammer.com/client_applications ?
Assuming yes, a lot of people run in to problems with IE and not having Yammer urls added to Trusted Sites in IE. If you can add more logs from your console output that it would help.
You can read more about what to include in your Trusted Sites here:
http://developer.yammer.com/connect/#IETrustedSites
When I add the host of where my app was running also in the Trusted Sites, it worked.
http://kendomen.wordpress.com/2014/11/06/yammer-authentication-with-javascript-and-yammer-sdk/

Service Unavailable 503 error, request from Google App Engine app

I have been using YouTube Data API from Google App Engine app for 5 months, without getting Service Unavailable, 503 error response. But today, I got this:
YouTubeError: {
'status': 503,
'body': '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n<html>\n<head><meta http-equiv="content-type" content="text/html; charset=utf-8"><title>http://gdata.youtube.com/action/GetUploadToken</title></head>\n<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();}">\n<div style="max-width:400px;">\n <hr noshade size="1" style="color:#ccc; background-color:#ccc;"><br>\n \n \n <div style="font-size:13px;">\n Our systems have detected unusual traffic from your computer network. Please try your request again later. Why did this happen?<br><br>\n <div id="infoDiv0" style="display:none; background-color:#eee; padding:10px; margin:0 0 15px 0; line-height:1.4em;">\n 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.<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 see this page if you are using advanced terms that robots are known to use, or sending requests very quickly.\n </div><br>\n \n IP address: 74.125.19.24<br>Time: 2012-10-09T17:48:20Z<br>URL: http://gdata.youtube.com/action/GetUploadToken<br>\n </div>\n</div>\n</body>\n</html>\n',
'reason': 'Service Unavailable'
}
I am using YouTube for uploading videos from users, and also for displaying existing videos (users only input the videos URL).
Does anybody know possible reasons why it isn't working?
I am using gdata python library.
I have yt_service property defined in my video model:
def yt_service(self):
try:
return self._yt_service
except AttributeError:
yt_service = gdata.youtube.service.YouTubeService()
yt_service.developer_key = settings.SYNCR_YT_DEVKEY
yt_service.email = settings.SYNCR_YT_EMAIL
yt_service.password = settings.SYNCR_YT_PASS
yt_service.ProgrammaticLogin()
self._yt_service = yt_service
return yt_service
Then when creating upload form, view call yt_service.GetFormUploadToken to retrieve upload token. It failed in here.

Unknown authorization header when using java gdata sdk

Lately, we are hitting about 30% failed API calls in our regression tests, caused by "Unknown authorization header" exception.
We are getting the following exception from gdata java sdk:
Caused By AuthenticationException:
com.google.gdata.util.AuthenticationException: Unknown authorization header
<HTML>
<HEAD>
<TITLE>Unknown authorization header</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unknown authorization header</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:600)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
at com.google.gdata.client.Service.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:998)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631)
at com.google.gdata.client.Service.getFeed(Service.java:1017)
We are running our regression tests using gdata api, using over 20 JVM for each test case.
This error is new. It emerged without changing our implementation, nor a significant change in load.
However, the error rate changes accordingly as we change the number concurrent JVMs, dropping to about 10% error rate as we reduce the number of JVMs to a few ones.
We would appreciate any help regarding the cause of the error and possible fixes.
Thanks
Assaf
private DocsService getDocsService(boolean withHeader) {
DocsService docsService = new DocsService(APP_NAME);
try {
docsService.setOAuthCredentials(getAuthParameters(),
new OAuthHmacSha1Signer());
if (withHeader) {
docsService.getRequestFactory().setHeader("If-Match", "*");
}
return docsService;
} catch (OAuthException oAuthException) {
throw new TestFlowException(
"Failed to set Google Drive Oauth Credentials",
oAuthException);
}
}
private GoogleOAuthParameters getAuthParameters() {
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey(GOOGLE_DRIVE_KEY.getKey());
oauthParameters.setOAuthConsumerSecret(GOOGLE_DRIVE_KEY.getSecret());
oauthParameters.setOAuthToken(ACCESS_CREDENTIALS.getKey());
oauthParameters.setOAuthTokenSecret(ACCESS_CREDENTIALS.getPassword());
return oauthParameters;
}

Resources