I am building an Express Application that tries to deploy a Smart Contract in a Quorum Blockchain running in Openshift.
When I run the Application it tries to unlock an account to deploy the contract with.
At this step I get the following error:
# UNLOCKED FAILED.
Error: Returned error: account unlock with HTTP access is forbidden
[0] at Object.ErrorResponse (/.../my-project/node_modules/web3-core-helpers/src/errors.js:29:16)
[0] at /.../my-project/node_modules/web3-core-requestmanager/src/index.js:140:36
[0] at XMLHttpRequest.request.onreadystatechange (/.../my-project/node_modules/web3-providers-http/src/index.js:96:13)
[0] at XMLHttpRequestEventTarget.dispatchEvent (/.../my-project/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
[0] at XMLHttpRequest._setReadyState (/.../my-project/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
[0] at XMLHttpRequest._onHttpResponseEnd (/.../my-project/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
[0] at IncomingMessage.<anonymous> (/.../my-project/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
[0] at IncomingMessage.emit (events.js:327:22)
[0] at endReadableNT (_stream_readable.js:1224:12)
[0] at processTicksAndRejections (internal/process/task_queues.js:84:21)
However, the endpoint of my Quorum node is https.
Here is the code causing the error:
const web3 = new Web3(HTTPS_QUORUM_ENDPOINT);
const account = (await web3.eth.getAccounts())[0];
await web3.eth.personal
.unlockAccount(account, ACCOUNT_PASSWORD)
.then((response) => {
console.log("# UNLOCKED. OKAY.");
})
.catch((error) => {
console.log("# UNLOCKED FAILED.");
console.error(error);
});
Am I doing something wrong? Can it be that the openshift gateway to the Quorum pod is not secured, even though the Route is?
the latest quorum release inherits upstream behaviour whereby it disallows unlock via HTTP-RPC for security reasons. There is a command line flag --allow-insecure-unlock which can be passed when starting geth which will re-allow this.
This is described in the upstream geth command line options here: https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options
(Note that geth doesn't actually support HTTPS, so that HTTPS_QUORUM_ENDPOINT must actually be using HTTP, or I'm guessing it uses HTTPS to connect to a reverse proxy which then attaches to geth over the HTTP-RPC port.)
I'm trying SignalR on ASP.NET Core. It works fine running from VisaulStudio debugger.
However it does not work in deployed code, showing the error message "WebSocket is not in the OPEN state" and "Handshake was canceled". What is the possible cause of the problem?
Microsoft.AspNetCore.Mvc 2.2.0
Microsoft.AspNetCore.SignalR 1.1.0
#aspnet/signalr 1.1.2
Bootstrap4
jQuery v3.1.0
Kestrel
No HTTPS SSL
Tried with Windows 7 and Ubuntu 18.4
Network Console on Google Chrome
WebSocket is not in the OPEN state (kms-event-exit.js:12)
Uncaught Error: Seerver returned handshake error: Handshake was canceled. (signalr.min.js:16)
at HubConnection.processHandshakeResponse (signalr.min.js:16)
at HubConnection.processIncomingData (signalr.min.js:16)
at WebSocketTransport.HubConnection.connection.onreceive (signalr.min.js:16)
at WebSocket.webSocket.onmessag (signalr.min.js:16)
[2019-04-06T01:06:41.965Z] Error: Connection disconnected with error 'Error: Server returned handshake error: Handshake was canceled.'. signalr.min.js:16
Uncaught (in promise) Server returned handshake error: Handshake was canceled. (signalr.min.js:16)
Startup functions.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
.AddRazorOptions(options => options.AllowRecompilingViewsOnFileChange = true);
services.AddSignalR(options => options.EnableDetailedErrors = true);
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseDeveloperExceptionPage();
if (!env.IsDevelopment())
{
//app.UseExceptionHandler("/Home/Main");
app.UseHsts();
}
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseSignalR(routes =>
{
routes.MapHub<Hubs.KmsHub>("/KmsHub");
routes.MapHub<Hubs.AllResetHub>("/AllResetHub");
});
app.UseMvc(routes =>
{
routes.MapRoute(
name: "areaDefault",
template: "{area:exists}/{controller=Home}/{action=Main}/{id?}");
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Main}/{id?}/{exit?}");
});
}
Logs
dbug: Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionDispatcher[4]
Establishing new connection.
dbug: Microsoft.AspNetCore.SignalR.HubConnectionHandler[5]
OnConnectedAsync started.
dbug: Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport[1]
Socket opened using Sub-Protocol: '(null)'.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/favicon.ico
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
Sending file. Request path: '/favicon.ico'. Physical path: 'D:\K4\KMS\KMS\bin\Release\netcoreapp2.2\publish\wwwroot\favicon.ico'
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 6.664ms 200 image/x-icon
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/lib/Popper/popper.min.js.map
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 3.4573ms 404
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/lib/bootstrap/dist/js/bootstrap.min.js.map
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/lib/signalr/dist/browser/signalr.min.js.map
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 2.3443ms 404
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
Sending file. Request path: '/lib/bootstrap/dist/js/bootstrap.min.js.map'. Physical path: 'D:\K4\KMS\KMS\bin\Release\netcoreapp2.2\publish\wwwroot\lib\boo
tstrap\dist\js\bootstrap.min.js.map'
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 114.858ms 200 text/plain
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/lib/bootstrap/dist/css/bootstrap.min.css.map
info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
Sending file. Request path: '/lib/bootstrap/dist/css/bootstrap.min.css.map'. Physical path: 'D:\K4\KMS\KMS\bin\Release\netcoreapp2.2\publish\wwwroot\lib\b
ootstrap\dist\css\bootstrap.min.css.map'
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 18.0356ms 200 text/plain
dbug: Microsoft.AspNetCore.SignalR.HubConnectionContext[2]
Handshake was canceled.
dbug: Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport[7]
Waiting for the client to close the socket.
dbug: Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport[2]
Socket closed.
dbug: Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionManager[2]
Removing connection 8K2CDgDs6jWXM7DPMWk_Dg from the list of connections.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 15047.5227ms 101
JavaScript code which caught the exception.
function kmsEventExit(url) {
var exitButton = document.getElementById("exitButton");
var connection = new signalR.HubConnectionBuilder().withUrl(url + "/KmsHub").build();
//Disable send button until connection is established
exitButton.disabled = true;
//Wait until connection finishes.
connection.start().then(function () {
exitButton.disabled = false;
}).catch(function (err) {
return console.error(err.toString()); //WebSocket is not in the OPEN state
});
//Call ExitKms on clicking the button.
exitButton.addEventListener("click", function (event) {
connection.invoke("ExitKms").catch(function (err) {
return console.error(err.toString());
});
event.preventDefault();
});
//Catch the result.
connection.on("ExitKmsResult", function (isAlert, options) {
if (isAlert) {
swal(JSON.parse(options));
}
});
}
There has been an workaround posted in a GitHub Issue that has worked for me.
Before connecting, add:
Object.defineProperty(WebSocket, 'OPEN', { value: 1, });
Using this method, there's no need to remove pace.js.
Important note: if you are using Blazor Server, you will face the same issue. Remove pace.js then, as it's quite useless in this case.
I have identified the problem!
It did not work because pace.js was not compatible with signalr.js. WebSocket variable was duplicated in these two plugins. SignalR works fine after removing pace.js.
SignalR on VisualStudio worked with pace.js because it uses SSE and IIS Express, instead of WebSocket and Kestrel, thus pace.js and signalr.js can be compatible with this particular configuration.
Reference:
https://github.com/aspnet/SignalR/issues/2389
As Identified above, pace and signalr are not directly compatible, however putting the script below before loading pace.js will resolve the problem instead of outrightly remove pace.js
<script>
window.paceOptions = { ajax: { ignoreURLs: ['mainHub', '__browserLink', 'browserLinkSignalR'], trackWebSockets: false } }
</script>
Reference to above answer: https://stackoverflow.com/questions/54770354/how-to-use-asp-net-core-signalr-with-pace-js
The value of 'mainHub' is the signalR hub in your C# application you are connecting to.
Using opentok.js v2, the video channel works fine with Chrome and Firefox . The opentok version used is from this link: https://static.opentok.com/v2/js/opentok.min.js
But it doesn't work with safari 11.0.3.
On session's stream created event, it generates following error message "The stream was unable to connect due to a network error. Make sure your connection isnt blocked by a firewall"
The publisher is published successfully i.e session.publish(..) works fine.
The code below is used to make a video call:
this.session=OT.initSession(this.apiKey, this.sessionId);
this.session.on({
streamCreated: (event) => {
this.session.subscribe(event.stream, 'subscriber');
},
streamDestroyed: (event) => {
console.log(`Stream ${event.stream.name} ended because ${event.reason}`);
}
});
this.session.connect(this.token, () => {
this.publisher=OT.initPublisher('publisher');
this.session.publish(this.publisher);
});
}
Other exceptions in console generated by opentok.js are as follows:
[Error] OT.exception :: title: undefined (1554) msg: OT.Subscriber PeerConnection Error: OT.Subscriber failed to subscribe to a stream in a reasonable amount of time
error
_exceptionHandler (vendor.js:150924)
handleJsException (vendor.js:151002)
onPeerConnectionFailure (vendor.js:162673)
(anonymous function) (vendor.js:162414)
onInvokeTask (vendor.js:4239)
runTask (polyfills.js:3:10225)
invokeTask (polyfills.js:3:16182)
n (polyfills.js:2:31400)
[Error] OT_ICE_WORKFLOW_FAILED: ICEWorkflow: Subscriber PeerConnection with connection (not found) failed: OT.Subscriber failed to subscribe to a stream in a reasonable amount of time
error
dispatchOTError (vendor.js:159161)
(anonymous function) (vendor.js:160080)
handleThisOnce (vendor.js:137437)
(anonymous function) (vendor.js:137675)
onInvokeTask (vendor.js:4239)
runTask (polyfills.js:3:10225)
invokeTask (polyfills.js:3:16182)
n (polyfills.js:2:31400)
[Error] OT.exception :: title: undefined (1554) msg: ICEWorkflow: Subscriber PeerConnection with connection (not found) failed: OT.Subscriber failed to subscribe to a stream in a reasonable amount of time
error
_exceptionHandler (vendor.js:150924)
handleJsException (vendor.js:151002)
dispatchOTError (vendor.js:159163)
(anonymous function) (vendor.js:160080)
handleThisOnce (vendor.js:137437)
(anonymous function) (vendor.js:137675)
onInvokeTask (vendor.js:4239)
runTask (polyfills.js:3:10225)
invokeTask (polyfills.js:3:16182)
n (polyfills.js:2:31400)
All the above errors are generated only on Safari browser.
You need to make sure you have created a Safari Project in your OpenTok Account Portal. More details at https://tokbox.com/developer/sdks/js/safari/
It looks like you're using a polyfills.js file. If that is the polyfill from Angular that includes zone.js then you will need to include the fix for RTCPeerConnections 'zone.js/dist/webapis-rtc-peer-connection' in your polyfills.js file.
import 'zone.js/dist/webapis-rtc-peer-connection';
You will also probably want to include the polyfill for getUserMedia. More details at https://github.com/angular/zone.js/issues/948#issuecomment-357558384
Well, I've started a simple project with freediameter library. what I need to achieve in my project is to create a client diameter application that could send some CCR request to a diameter server.
for this matter, I tried to create a new extension for freediameter daemon.
So, the first thing I did was to setup the peer diameter server in config file:
ConnectPeer = "vm-pc.my.domain" { No_TLS; ConnectTo = "192.168.56.2"; Port=3868; };
and then initialize a request message in ta_entry function, in message body i specified the Destination-Host and Destination-Realm but still I receive this error:
01/10/17,01:55:24.980611 ERROR Routing error: 'No remaining suitable candidate to route the message to' for the following message:
01/10/17,01:55:24.980620 ERROR 'Credit-Control-Request'
01/10/17,01:55:24.980628 ERROR Version: 0x01
01/10/17,01:55:24.980635 ERROR Length: 20
01/10/17,01:55:24.980642 ERROR Flags: 0xC0 (RP--)
01/10/17,01:55:24.980649 ERROR Command Code: 272
01/10/17,01:55:24.980656 ERROR ApplicationId: 4
01/10/17,01:55:24.980664 ERROR Hop-by-Hop Identifier: 0x00000000
01/10/17,01:55:24.980671 ERROR End-to-End Identifier: 0xDCA05EF4
01/10/17,01:55:24.980678 ERROR {internal data}: src:(nil)(0) rwb:0x0 rt:0 cb:0x80523df30,0x0(0x803397da0) qry:0x0 asso:0 sess:0x0
01/10/17,01:55:24.981562 ERROR AVP: 'Session-Id'(263) l=8 f=-M val="hadi-pc.my.domain;1484000714;6"
01/10/17,01:55:24.981569 ERROR AVP: 'Origin-Host'(264) l=8 f=-M val="hadi-pc.my.domain"
01/10/17,01:55:24.981577 ERROR AVP: 'Origin-Realm'(296) l=8 f=-M val="my.domain"
01/10/17,01:55:24.981584 ERROR AVP: 'Destination-Host'(293) l=8 f=-M val="vm-pc.my.domain"
01/10/17,01:55:24.981591 ERROR AVP: 'Destination-Realm'(283) l=8 f=-M val="my.domain"
01/10/17,01:55:24.981599 ERROR AVP: 'Auth-Application-Id'(258) l=12 f=-M val=4 (0x4)
01/10/17,01:55:24.981606 ERROR AVP: 'CC-Request-Type'(416) l=12 f=-M val='EVENT_REQUEST' (4 (0x4))
01/10/17,01:55:24.981613 ERROR AVP: 'CC-Request-Number'(415) l=12 f=-M val=2 (0x2)
Can anybody help me on this ?
ps: as I see in the logs the CER/CEA are normal.
What Origin-Realm was signaled in the Capability-Exchange-Answer message when the connection was established?
The Diameter request routing process (as described in https://www.rfc-editor.org/rfc/rfc6733#section-6.1) relies on the realm, so if the Origin-Realm returned by the peer is not "my.domain", freeDiameter will not route to this peer, even if the Origin-Host matches.
I've been trying to create an uploader for avatars, but I've been facing some issues, the code works perfectly on dev, but on the production release, I get this error:
=SUPERVISOR REPORT==== 8-Jul-2016::22:35:41 ===
Supervisor: {local,'Elixir.ExAws.Supervisor'}
Context: child_terminated
Reason: {#{'__exception__' => true,
'__struct__' => 'Elixir.Poison.SyntaxError',
message => <<"Unexpected token: <">>,
token => <<"<">>},
[{'Elixir.Poison.Parser','parse!',2,
[{file,"lib/poison/parser.ex"},{line,56}]},
{'Elixir.Poison','decode!',2,
[{file,"lib/poison.ex"},{line,83}]},
{'Elixir.ExAws.InstanceMeta',security_credentials,1,
[{file,"lib/ex_aws/instance_meta.ex"},{line,16}]},
{'Elixir.ExAws.Config.AuthCache',refresh_config,2,
[{file,"lib/ex_aws/config/auth_cache.ex"},{line,37}]},
{'Elixir.ExAws.Config.AuthCache',handle_call,3,
[{file,"lib/ex_aws/config/auth_cache.ex"},{line,27}]},
{gen_server,try_handle_call,4,
[{file,"gen_server.erl"},{line,615}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,647}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,247}]}]}
Offender: [{pid,<0.2009.0>},
{id,'Elixir.ExAws.Config.AuthCache'},
{mfargs,
{'Elixir.ExAws.Config.AuthCache',start_link,
[[{name,'Elixir.ExAws.Config.AuthCache'}]]}},
{restart_type,permanent},
{shutdown,5000},
{child_type,worker}]
22:35:41.624 [error] Ranch protocol #PID<0.2011.0> (:cowboy_protocol) of listener MyApp.Endpoint.HTTP terminated
** (exit) exited in: GenServer.call(ExAws.Config.AuthCache, {:refresh_config, %ExAws.S3{config: %{access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, :instance_role], host: %{"ap-northeast-1" =>
"s3-ap-northeast-1.amazonaws.com", "ap-southeast-1" => "s3-ap-southeast-1.amazonaws.com", "ap-southeast-2" => "s3-ap-southeast-2.amazonaws.com", "eu-central-1" => "s3-eu-central-1.amazonaws.c
om", "eu-west-1" => "s3-eu-west-1.amazonaws.com", "sa-east-1" => "s3-sa-east-1.amazonaws.com", "us-east-1" => "s3.amazonaws.com", "us-west-1" => "s3-us-west-1.amazonaws.com", "us-west-2" => "
s3-us-west-2.amazonaws.com"}, http_client: ExAws.Request.HTTPoison, json_codec: Poison, region: "us-east-1", scheme: "https://", secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, :insta
nce_role]}, service: :s3}}, 5000)
** (EXIT) an exception was raised:
** (Poison.SyntaxError) Unexpected token: <
(poison) lib/poison/parser.ex:56: Poison.Parser.parse!/2
(poison) lib/poison.ex:83: Poison.decode!/2
(ex_aws) lib/ex_aws/instance_meta.ex:16: ExAws.InstanceMeta.security_credentials/1
(ex_aws) lib/ex_aws/config/auth_cache.ex:37: ExAws.Config.AuthCache.refresh_config/2
(ex_aws) lib/ex_aws/config/auth_cache.ex:27: ExAws.Config.AuthCache.handle_call/3
(stdlib) gen_server.erl:615: :gen_server.try_handle_call/4
(stdlib) gen_server.erl:647: :gen_server.handle_msg/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Thanks.
Your stack trace says that Poison, a dep that ExAws uses, failed to decode a json. If you check the module that made that call (lib/ex_aws/instance_meta.ex, you can read it here), you'll find that it communicates with Amazon to check your credentials.
The most probable thing is that your configuration is incorrect and Amazon is sending you an error message formatted as an XML or HTML (both begin with <).
ExAws config depends on env vars, so that's also probably why it works on dev, but not on production.