So I'm trying to use Axios to fetch some data before the test begins.
the test step is defined as follows
const axios = require('axios');
step("GET google", async function() {
await axios.get("https://www.google.com/")
});
And I have a test spec that looks like this
# Getting Started with Gauge
## GET google
* GET google
This is on a fresh Taiko/Gauge project. When running gauge runs specs I get the following error
Installing required plugins.
# Getting Started with Gauge
## GET google F
Failed Step: GET google
Specification: specs\test.spec:6
Error Message: AxiosError: Request failed with status code 400
Stacktrace:
And nothing else happens
Related
My firebase functions was running fine till last night, but it has stopped working now.
When I run my functions I get this error on my Google cloud platform log -
"Step #5 - "exporter": [31;1mERROR: [0mfailed to export: failed to write image to the following tags: [us.gcr.io/tookforms/gcf/us-central1/77926137-2972-4613-947e-c66d12cfd46f:calc_version-59: GET https://storage.googleapis.com/us.artifacts.tookforms.appspot.com/containers/images/sha256:b18e538d0dbca11a254142f571dfce8058959925b5e8c2c25679211b8b1bf0c6?access_token=REDACTED: unexpected status code 404 Not Found: <?xml version='1.0' encoding='UTF-8'?><Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Details>No such object: us.artifacts.tookforms.appspot.com/containers/images/sha256:b18e538d0dbca11a254142f571dfce8058959925b5e8c2c25679211b8b1bf0c6</Details></Error>]" insertId: "3f132e37-fa6b-4f0a-8dc4-1244dca5a7a5-228"
It's saying that it's trying to upload some image to somewhere on google cloud platform. But I don't have anything to do with any image in my function. I don't even understand exactly what the "image" means over here.
This is the second error I am getting just below the first error -
ERROR: build step 5 "us.gcr.io/fn-img/buildpacks/nodejs12/builder:nodejs12_20210310_12_21_0_RC00" failed: step exited with non-zero status: 246
I tried looking for what Status Code 246 means but apparently it's something made by google. I am not sure.
Here's my function code -
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.calc = functions.https.onCall(async (data, context) => {
console.log('hello');
});
Something was wrong with firebase functions on google cloud sever. I just removed the faulty firebase function from functions dashboard and deployed my local function again. And it worked.
I have checked and tried these solutions here but none is helping
error: (-215) !empty() in function detectMultiScale
OpenCV.js - detectMultiScale "This Exception cannot be caught"
I also read elsewhere that the problem could be because the file needs to be served via an Http request and so I decided to use ngrok but I still found the same error. Currently am using python http.server
Here is the section of the code:
let classifier = new cv.CascadeClassifier();
let utils = new Utils('errorMessage'); //use utils class
let faceCascadeFile = "http://localhost:8000/docs/haarcascade_frontalface_default.xml";
//let faceCascadeFile = "D:\Code\Fit-to-Interact-web\docs\haarcascade_frontalface_default.xml"
//let faceCascadeFile = "https://0979da552cb5.ngrok.io/docs/haarcascade_frontalface_default.xml"; // path to xml
// use createFileFromUrl to "pre-build" the xml
//Make sure to run it in a webserver because it has to do XMLHTTPRequests.
utils.createFileFromUrl(faceCascadeFile, faceCascadeFile, () => {
classifier.load(faceCascadeFile); // in the callback, load the cascade from file
});
console.log(classifier.empty())
Worse when I use the absolute/relative file path I get this error Not allowed to load local resource or sometimes the same error:
Exception: OpenCV(4.4.0) /build/master-contrib_docs-lin64/opencv/modules/objdetect/src/cascadedetect.cpp:1689:
error: (-215:Assertion failed) !empty() in function 'detectMultiScale'
I just followed the instructions to setup and test it. I used Javascript API. When I tried to message using two tabs or two windows as mentioned in the docs it is not working. It throws error at sendMessage method being "undefined". when I console log it gets the correct message typed in the html element.
As soon as I start localhost it throws following error. Any suggestions please.
Navigated to http://localhost:3000/
cds.twilio.com/v2/Streams:1 POST https://cds.twilio.com/v2/Streams 403 (Forbidden)
twilio-ip-messaging.min.js:198 IPMSG: failed to create session Object {status: 403, description: "Forbidden", body: "{"message":"Access forbidden","status":403}"}(anonymous function) # twilio-ip-messaging.min.js:198
undefined:1 Uncaught (in promise) Object {status: 403, description: "Forbidden", body: "{"message":"Access forbidden","status":403}"}
undefined:1 Uncaught (in promise) Object {status: 403, description: "Forbidden", body: "{"message":"Access forbidden","status":403}"}
undefined:1 Uncaught (in promise) Object {status: 403, description: "Forbidden", body: "{"message":"Access forbidden","status":403}"}
twilio-ip-messaging.min.js:199 Twilsock connection closed by server []r._onSocketRejected # twilio-ip-messaging.min.js:199d.create.callbacks.onsocketRejected # twilio-ip-messaging.min.js:199e.doCallback # twilio-ip-messaging.min.js:281e.afterThisEvent # twilio-ip-messaging.min.js:281e.afterEvent # twilio-ip-messaging.min.js:281transition # twilio-ip-messaging.min.js:281(anonymous function) # twilio-ip-messaging.min.js:281r.onmessage # twilio-ip-messaging.min.js:199
Twilio developer evangelist here.
First of all, you will need to use your production Account Sid in order to get this to work.
Twilio test credentials only work on certain parts of the REST API.
Once you have generated your token on the server side, you need to get it to the client side and authenticate your client like this:
accessManager = new Twilio.AccessManager(token);
messagingClient = new Twilio.IPMessaging.Client(accessManager);
Take a look at the IP Messaging quick start code to see an example of how it is done. The full instructions for the quick start guide can be found here.
Let me know if that helps at all.
I am building a web app that allows users to type in phone numbers and send text messages via the Twilio API. I've built the functionality in a file, shown below. If I cd to this file and run node twilioActions.js, the text message gets sent.
var client = require('twilio')(CLIENT_ID, CLIENT_SECRET);
// ideally, I'd like to send the message using this method and call this from other JavaScript files
export const sendMessage = () => {
}
// the following code works when I run 'node twilioActions.js'
client.sendMessage({
to:'...',
from: '...',
body: 'Text message test.'
}, function(err, responseData) {
if (!err) {
console.log(responseData.from); // outputs "+14506667788"
console.log(responseData.body); // outputs "word to your mother."
}
});
However, I want to call the sendMessage method from a different React file. Here is it:
import * as twilioActions from './twilioActions';
class PhoneView extends React.Component{
// other methods are hidden obviously, the one below is called when a button is pressed to send a message.
sendMessage() {
twilioActions.sendMessage();
}
}
When I try to build the project, I get the following errors:
ERROR in ./~/twilio/package.json
Module parse failed:/Users/Felix/Desktop/ECE590/node_modules/twilio/package.json Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
| "_args": [
| [
| "twilio",
# ./~/twilio/lib/Client.js 5:17-43
ERROR in ./~/request/lib/har.js
Module not found: Error: Cannot resolve module 'fs' in /Users/Felix/Desktop/ECE590/node_modules/request/lib
# ./~/request/lib/har.js 3:9-22
ERROR in ./~/tunnel-agent/index.js
Module not found: Error: Cannot resolve module 'net' in /Users/Felix/Desktop/ECE590/node_modules/tunnel-agent
# ./~/tunnel-agent/index.js 3:10-24
ERROR in ./~/tunnel-agent/index.js
Module not found: Error: Cannot resolve module 'tls' in /Users/Felix/Desktop/ECE590/node_modules/tunnel-agent
# ./~/tunnel-agent/index.js 4:10-24
I feel like I am making a simple mistake and perhaps am not using the correct libraries or including the proper references. Could someone point me in the right direction about how to get this to work? Thank you so much!
Twilio developer evangelist here.
The twilio npm module is not built or recommended for use in the front end. The main thing is that you would need to expose your account credentials in the front end code of your site. This is a security risk as it means a malicious attacker could get hold of your credentials and abuse your Twilio account.
I recommend creating a service on your server side that you can call to with an AJAX request in order to perform actions like this.
I'm working on a Python API to handle REST calls to MongoDB. The API is based on Kule (and thus includes Bottle and PyMongo modules). The front-end is built using node.js. I have been developing and testing on localhost with the API, front-end, and MongoDB on different ports.
I have set up the API and have been trying to get CRUD requests to work. I can get these to work from a Python script as well as from Javascript running on Apache server. However, when I add the same code to the front-end, GET works, but POST fails with a 500 error.
This POST code works on the Apache server:
var myrequest=new XMLHttpRequest();
myrequest.onreadystatechange=function(){
if (myrequest.readyState==4){
if (myrequest.status==201){
alert(myrequest.responseText);
} else{
alert("An error has occured making the request");
}
}
}
myrequest.open("POST", "http://localhost:8080/items", true);
myrequest.setRequestHeader("Content-type", "application/json;charset=UTF-8");
myrequest.send(JSON.stringify({'name' : 'Name', 'description' : 'Description'}));
When I add this to the front-end, I get the following traceback from Kule:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\bottle.py", line 764, in _handle
return route.call(**args)
File "C:\Python27\lib\site-packages\bottle.py", line 1625, in wrapper
rv = callback(*a, **ka)
File "C:\Python27\lib\site-packages\bottle.py", line 1575, in wrapper
rv = callback(*a, **ka)
File "C:\Python27\lib\site-packages\kule\kule.py", line 64, in post_list
inserted = collection.insert(request.json)
File "C:\Python27\lib\site-packages\pymongo\collection.py", line 351, in insert
docs = [self.__database._fix_incoming(doc, self) for doc in docs]
TypeError: 'NoneType' object is not iterable
127.0.0.1 - - [24/Jun/2014 07:53:40] "POST /scenarios HTTP/1.1" 500 50
So, what am I doing wrong? Why does the Javascript break in node.js? I have GET working, but POST fails. Why?
Thanks!
I found my error.
myrequest.setRequestHeader("Content-type", "application/json;charset=UTF-8");
"Content-type" should be "Content-Type" with an upercase "T".
Silly mistake. Left as a note to others.