How to get sanity client on v3 scripts? - sanity

I didn't find a way to get client on Sanity v3 script. The old version was getting it from 'part:#sanity/base/client' and it doesn't work for v3.
Well, it's simple:
import { getCliClient } from 'sanity/cli';
const client = getCliClient().withConfig({ apiVersion: '2022-09-09' });
Then you can execute your script this way:
node_modules/.bin/sanity exec path-to/my-script.js --with-user-token

Related

Error org/apache/http/conn/ssl/TrustAllStrategy on Karate test when using HTTPS

I'm new to Karate and automation and asking for your advice on how to resolve my problem.
I'm running my Karate tests in HTTPS URL but I'm getting the error org/apache/http/conn/ssl/TrustAllStrategy
Anybody has encountered this error before? How did you resolve this?
This occurs after putting * configure ssl = true in my feature file
My karate-config.js looks like this:
function fn() {
var config = {
urlBase: 'https://<our url here>'
}
//karate.configure('ssl', true);
karate.configure('connectTimeout', 10000);
karate.configure('readTimeout', 10000);
return config;
}
My feature file looks like this:
Feature: View Check History
Background:
* configure ssl = true
* url urlBase
You most certainly have a library conflict, my guess is you have mixed Karate into an old project that already uses the Apache HTTP client. You have to resolve this yourself. My suggestion is try the quickstart here, which will work - and then you can compare with what's going on in your project: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
Take the help of someone who knows Maven if needed. All the best.

Developing using Netlify Dev with Vue JS and Netlify Functions

I am using vue + netlify for a small web app that uses netlify functions I built. Everything works fine in production (when I commit to master and netlify auto-deploys based on my master branch) but when I try to use netlify dev to spin up a local development instance, calls to the netlify function are failing:
VM23:1 POST http://localhost:18002/.netlify/functions/customfunction 404 (Not Found)
Clearly the endpoint in the dev enironment is not the same, but how do I know what that endpoint may be? In the console when running the netlify dev command it says that the lambda server is listening on 3467... but trying to use endpoint http://localhost:34567/.netlify/functions/customfunction results in a CORS error. Any help here would be appreciated!
you might be getting the CORS error because your server is not running on the same host with your vue app and to fix this you have to set a proxy and for that you need to create a vue.config.js file on the project directory (not the vue folder) then past the following code:
module.exports = {
devServer: {
proxy: 'http://localhost:34567' // the port your server in running on
}
}
now your proxy is set so your request URL will the following :
/.netlify/functions/customfunction
Doc reference : https://cli.vuejs.org/config/#devserver-proxy

Failed to construct 'RTCPeerConnection': Unsatisfiable constraint IceTransports

I trying to setup RestComm Web SDK demo application on my local system, I just want to create an application for audio/video, chat, IVR, etc(RestComm provide me perfect solution for my needs). Now I have setup RestComm Web SDK on my local system and whenever I an trying to sip call, It throws WebRTCommClient:call(): catched exception:NotSupportedError: Failed to construct 'RTCPeerConnection': Unsatisfiable constraint IceTransports on browser console.
My webRTC confrigration is as below:
// setup WebRTClient
wrtcConfiguration = {
communicationMode: WebRTCommClient.prototype.SIP,
sip: {
sipUserAgent: 'TelScale RestComm Web Client 1.0.0 BETA4',
sipRegisterMode: register,
sipOutboundProxy: parameters['registrar'],
sipDomain: parameters['domain'],
sipDisplayName: parameters['username'],
sipUserName: parameters['username'],
sipLogin: parameters['username'],
sipPassword: parameters['password'],
},
RTCPeerConnection: {
iceServers: undefined,
stunServer: 'stun.l.google.com:19302',
turnServer: undefined,
turnLogin: undefined,
turnPassword: undefined,
}
};
While I can use olympus without any issue in Chrome Browser. I am stuck with this exception, any suggestions would be highly appreciated.
I think the problem here is that the version of Webrtcomm library inside the demo application you are using is outdated and doesn't include a fix for latest Chrome version. So please replace samples/hello-world/scripts/WebRTComm.js within your repository, with:
https://github.com/RestComm/webrtcomm/blob/master/build/WebRTComm.js
That should fix your issue.
Best regards,
Antonis Tsakiridis

SignalR getting 403 on AppHarbor after updating to v. 1.0.1 (Chrome)

I was using SignalR v. 1.0.0 RC2, and it worked fine. When I upgraded to v. 1.0.1 it stopped working. I am now getting a 403 (forbidden) when I am trying to invoke a method on the hub. I did not change any code - I only updated to the newer version of SignalR. It is important to note that I do not have any problems when I run it locally - only when I run it on AppHarbor, and only in the Chrome browser. It works in IE 10 and Firefox 20.
I know that some work has been done in the newer version of SignalR for authorization. Now you can add an Authorize attribute on your hub, or your hub methods. I want to do that, but first I would like it to work without - like it did before.
This is my hub:
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
public class ReceptionHub : Hub
{
public Task Join(string group)
{
return Groups.Add(Context.ConnectionId, group);
}
}
And this is the client site script (I get the group from a data attribute in the markup):
$(function () {
var receptionHub = $.connection.receptionHub;
receptionHub.client.updateStatusBar = function (checkedIn, checkedOut, preRegistered)
{
$('#quantityCheckedInToday').html(checkedIn);
$('#quantityCheckedOutToday').html(checkedOut);
$('#quantityPreRegistered').html(preRegistered);
};
$.connection.hub.start().done(function () {
var group = $("#statusBar").data("group");
receptionHub.server.join(group);
});
});
One difference between my local setup and the setup on AppHarbor is that I run the AppHarbor site on HTTPS, but that was not a problem before. Also, there is a loadbalancer infront of the server on AppHarbor.
The request that fails is a POST request to this URL:
/signalr/send?transport=serverSentEvents&connectionToken=5hSSl7wSPrkD51cmPNw-JCrrdxMn2qOgEgmKt5gKrE4jigE4Sxha3gALHREcyDslqb7xjY9fP8rTMpslKuBJzBCIi-q86ZmHt66xhqi2eioAtvQCO03XlcR0Dq9-RW5G0
Any help is much appreciated
I have now tried using SignalR 1.1.2 - and it still did not work in Chrome, but this time it gave a much better error message. It said that CORS was turned off. I tried turning CORS on in the configuration:
var config = new HubConfiguration
{
EnableCrossDomain = true
};
// Register the default hubs route: ~/signalr
RouteTable.Routes.MapHubs(config);
This fixed the problem I was having, and now it works again in Chrome. I am not sure why CORS needs to be turned on to get it working in Chrome... maybe some special AppHarbor setup.

Node.js + SSL support

Recent commits reference TLS progress. Any idea when it will be ready?
If not, what are the options for using SSL with a node app at the present time? Reverse proxy nginx? Is there a good tutorial available for using SSL with node?
Most professional apps need to support SSL these days and it would be great to be able to use node for these now.
Node.js 0.3.4 has been released.
Primordal mingw build (Bert Belder)
HTTPS server
Built in debugger 'node debug script.js'
realpath files during module load (Mihai Călin Bazon)
Rename net.Stream to net.Socket
Fix process.platform
Example
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8000);
Node 3.x is not supposed to be used in production, it's unstable, bleeding edge development. 2.6 still has the old SSL implementation, which works.
If you want to know when all the stuff gets finished, your best bet is to either ask on the Google Group, or Ryan on Twitter.
Just for reference ... here's a JavaScript implementation of SSL/TLS:
https://github.com/digitalbazaar/forge
At the moment, it is only a client-side implementation. It would need to be expanded to cover server-side. For someone with a little knowledge about how TLS works, however, it shouldn't be too difficult to add to the existing framework.
From my experience node 0.2 SSL support is very flacky and unreliable.
We use nginx as a proxy.