Using axios-cookiejar-support with Vue.js on the backend - javascript

Has anyone used axios-cookiejar-support with Vue.js on the backend?
I'm getting the following error in the Chrome debugger:
Uncaught (in promise) TypeError: axiosCookieJarSupport is not a function
And when I console.log(axiosCookieJarSupport) I see "undefined" when I run the the init code shown on the axios-cookiejar-support site that modifies Axios to support cookies:
const axiosCookieJarSupport = require('axios-cookiejar-support').default;
axiosCookieJarSupport(axios); // <--- error occurs here
Obviously, I tried it with a Node.js console application and it works, and I can console.log axiosCookieJarSupport and I see that it is a function in the console application.
I'm guessing I need to somehow tell Webpack (which I believe Vue.js uses) to preload axios-cookiejar-support, as opposed to just include it in the package.json (which I did), but I'm not sure how to do it.

Related

How to get SubtleCrypto work with testcafe?

I am generating SHA256 using SubtleCrypt Web API on client-side as following:
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
Everything works fine except for when I execute tests via testcafe. The captured console error says TypeError: Cannot read properties of undefined (reading 'digest') meaning crypto.subtle is undefined.
I know that SubtleCrypto is available only in secure contexts which also includes localhost and I am using localhost to run my end-to-end testcafe tests.
What am I doing wrong?
You need to run TestCafe over HTTPS protocol. See more information in the following help topic: test-https-websites.

TypeError when testing with Jest and Formidable

I have wrote a cusom express middleware to pars an incoming multipart form.
The middleware works fine when launched in local or deployed but the test with jest fails with the error
TypeError: Cannot set property domain of [object process] which has only a getter
The issues seems to come from the package asap used by formidable.
I think that Jest is putting some limitations on the process object since the line where everything breaks is
domain.active = process.domain = null;
in the file raw.js
Does anyone has any workaround or solution for this issue? I cannot migrate to formidable V3 at the moment so that's not an option

Failed to Load Resource In Production but Not Locally

I am working on a Django project and I have it deployed on pythonanywhere.com. In my project, I am using Django Jsignature which works fine on my local machine. In production, however, when I load the particular template, I get this error in my console - 'myurl' portion is not the real url.
https://myurl.com/static/js/jSignature.min.js net::ERR_ABORTED 404 (Not Found)```
So I don't get this locally, but do in Production. Can anyone suggest for me where to start on this? I'm not even really sure where to begin, it's my first time deploying anything.
EDIT
you can see the details of django jsignature here: https://pypi.org/project/django-jsignature/
the {{form.media}} should load this script.
UPDATE 2
This is no longer working locally either. Here are the error in my console.
Uncaught SyntaxError: Invalid or unexpected token jSignature.min.js:70
Uncaught TypeError:
$(...).jSignature is not a function

Uncaught ReferenceError: Meteor is not defined

I'm following a tutorial to create a Meteor app and I've been having the same error regarding different things in the developer console.
> Meteor.users.find().count();
VM2034:1 Uncaught ReferenceError: Meteor is not defined(…)(anonymous function) # VM2034:1
> Session.set('pageTitle', 'A different title');
VM2035:1 Uncaught ReferenceError: Session is not defined(…)
From researching the problem, the 2 solutions that come up are: (1) doing
meteor add session
which I have done; (2) updating the Meteor version but I am running Meteor 1.3.3. Neither works.
EDIT: After doing meteor update, the Meteor error disappeared once but came back the second time I tried a command based on Meteor.
Any idea on how to solve this?
If you are trying to set the session outside the client folder you will get this error. Which is why you must do:
if(Meteor.isClient) {
Session.set('pageTitle', 'A different title');
}
Then you can check it worked simple write in console:
Session.get('pageTitle')
Will output: "A different title"
Good luck!

Webpack + React and Google Chrome 43.0.2357.65

After updating Google Chrome (v. >= 43.0.2357.65) error was displayed in console: Uncaught SyntaxError: Unexpected token function in different places of my bundle.js.
It appears only when bundle.js returns 200 http status. But after refresh page this file returns 304 http status and all works fine without errors. I'm using webpack v.1.8.5 and React v.0.13.2
In other browsers code works fine, and in Google Chrome before update it works fine.
See this Chrome issue and this related Twitter conversation from the person who filed it.
If you're using an older version of Node.js in your build, updating it might fix this. From the issue:
broken.js was the result of a build script running in Node.js 0.10.18, which seems to have written the file with some peculiar character encoding issues

Categories