PhantomJS doesn't run .create() - npm

Hardware - Macbook Pro 2019 - Catalina 10.15.5
using Visual Studio Code
In my project we have the following issue;
On a Linux machine it is working, on a Windows machine it is working, on my machine is NOT working.
The code that is not working is this one.
phantom.create().then(function (ph) {
ph.createPage().then(function (page) {
page.property('paperSize', {
format: 'A4',
orientation: 'portrait',
margin: '0'
}).then(function () {
it is crashing on the phantom.create() function.
I tried to do variations, to see the objects getting built, like,
ph = phantom.create();
console.log('after the phantom create ');
console.log(ph);
console.log('this is the ph **');
(async function (ph) {
page = ph.createPage().then(
function (page) {
page.property('paperSize', {
format: 'A4',
orientation: 'portrait',
margin: '0'
Still crashing.
Using wait and async
(async function() {
ph = await phantom.create();
page = await instance.createPage();
ph.createPage().then(function (page) {
page = page;
page.property('paperSize', {
format: 'A4',
orientation: 'portrait',
margin: '0'
}).
In terminal when I do:
Node > require('phantom').create()
I get the following
> require('phantom').create()
Promise {
Phantom {
logger:
{ info: [Function],
debug: [Function],
error: [Function],
warn: [Function] },
process:
ChildProcess {
domain: [Domain],
_events: [Object],
_eventsCount: 2,
_maxListeners: undefined,
_closesNeeded: 3,
_closesGot: 0,
connected: false,
signalCode: null,
exitCode: null,
killed: false,
spawnfile: '/usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs',
_handle: [Process],
spawnargs: [Array],
pid: 14804,
stdin: [Socket],
stdout: [Socket],
stderr: [Socket],
stdio: [Array] },
commands: Map {},
events: Map {},
heartBeatId:
Timeout {
_called: false,
_idleTimeout: 100,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 3640,
_onTimeout: [Function: bound heartBeat],
_timerArgs: undefined,
_repeat: 100,
_destroyed: false,
domain: [Domain],
[Symbol(asyncId)]: 40,
[Symbol(triggerAsyncId)]: 6 } },
domain:
Domain {
domain: null,
_events:
{ removeListener: [Function: updateExceptionCapture],
newListener: [Function: updateExceptionCapture],
error: [Function: debugDomainError] },
_eventsCount: 3,
_maxListeners: undefined,
members: [] } }
When I use the debugger it's crashing on line
ph = phantom.create();
and resume debugger and then pause it's stuck on async_hooks.js - line const fn = function(asyncId) giving an enless loop until I get a timeout.
function emitHookFactory(symbol, name) {
// Called from native. The asyncId stack handling is taken care of there
// before this is called.
// eslint-disable-next-line func-style
const fn = function(asyncId) {
active_hooks.call_depth += 1;
// Use a single try/catch for all hook to avoid setting up one per
// iteration.
try {
for (var i = 0; i < active_hooks.array.length; i++) {
if (typeof active_hooks.array[i][symbol] === 'function') {
active_hooks.array[i][symbol](asyncId);
}
}
I also tried changing the launch.json and adding
"skipFiles": [
"inspector_async_hook.js",
"async_hooks.js",
"node_internals/**/*.js"
],
Still stucks on async_hooks.js though.
Any ideas what might be the reason?
Should I change to a Windows machine?
I'm installing a VM in the meantime.

Related

react native IOS can not access microphone when lockscreen + app killed

I am building Calling app, includes:
1.PushKit VOIP to show incomming call
2.React-native-callkeep to handle answer/end call
3. React-native-webrtc to make the call
The problem is:
1.With app state active/background. The call working normally
2.Only with case app locked + app not running. I can not see the microphone in top of screen, then I think I can not access into the microphone(tested with audio call)
About my code: I am getMediaDivices in useEffect() like this:
useEffect(() => {
....
getMediaStream()
return () => {
mounted.current = false
....
}
}, [])
const getMediaStream = async () => {
if (!localMediaStream) {
let isFront = true
let stream = await mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true,
googEchoCancellation: true,
googAutoGainControl: true,
googNoiseSuppression: true,
googHighpassFilter: true,
googTypingNoiseDetection: true,
googNoiseReduction: true
},
video: isVideo ? {
width: { min: 480, max: 1280},
height: { min: 320, max: 720 },
// vb: true,
frameRate: 25,
facingMode: (isFront ? 'user' : 'environment'),
} : false
})
setlocalMediaStream({
publisher: {
id: currentUserName,
userId: masterInfo.user.id,
displayName: masterInfo.user.name
},
stream: stream,
})
await initJanus(stream)
}
}
I dont know why the green dot not appear in case 3, can someone help?

Missing Permissions discord.js V13

it's me again, with another new problem!
I'm wanting to make a charge command where you use the menu, but there was an error!
Missing Permissions
If you want to see what's going on, I'll say it's not in slash commands!
gamerole.js
const { MessageActionRow, MessageSelectMenu, MessageEmbed } = require("discord.js")
module.exports = {
name: 'gamerole',
description: "get gaming console roles",
userPerms: ["ADMINISTRATOR"],
run: async(client, message, args, prefix) => {
if(!message.content.startsWith(prefix)) return;
const embed = new MessageEmbed()
.setTitle("Gaming Console Roles")
.setDescription("Get Or Remove Roles By Clicking On Options Given In menu, After Reclicking The Role Will Be Removed, The Bot Will Send DM Message That You Have Added/Removed Roles")
const row = new MessageActionRow()
.addComponents(
new MessageSelectMenu()
.setCustomId('gamerole')
.setPlaceholder('Select To Add/Remove Roles')
.addOptions([
{
label: 'XBOX Role',
description: "Click To Add/Remove XBOX Roles",
value: 'xbox',
},
{
label: 'PlayStation Role',
description: "Click To Add/Remove PlayStation Roles",
value: 'playstation',
},
]),
);
await message.channel.send({ embeds: [embed], components: [row]});
}
}
After that I went into messageCreate to see if the problem was there!
messageCreate.js
const db = require("quick.db");
const client = require("../index.js");
client.on('messageCreate', async (message) => {
if(message.author.bot) return;
if(!message.guild) return;
//PER SERVER PREFIX
let prefix = await client.config.prefix;
//1 if (!message.content.startsWith(client.config.prefix)) return;
if(!message.content.startsWith(prefix)) return;
if(!message.member) message.member = await message.guild.fetchMember(message);
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
if(cmd.length == 0 ) return;
let command = client.commands.get(cmd);
if(!command) command = client.commands.get(client.aliases.get(cmd));
if(command) {
//USER PERMS
if(!message.member.permissions.has(command.userPerms || [])) return message.channel.send(`User Dont Have \`${command.userPerms || []}\` Permission`);
//BOT PERMISSIONS
if(!message.guild.me.permissions.has(command.clientPerms || [])) return message.channel.send(`Bot Missing \`${command.botPerms || []}\` Permission`);
}
//EXPORTS TO COMMAND
if(command) command.run(client, message, args, prefix);
});
The error is as follows:
DiscordAPIError: Missing Permissions
at RequestHandler.execute (/home/runner/B
ot-beta/node_modules/discord.js/src/rest/Requ
estHandler.js:350:13)
at processTicksAndRejections (node: intern
al/process/task_queues:96:5)
at async RequestHandler.push (/home/runne
r/Bot-beta/node_modules/discord.js/src/rest/R
equestHandler.js:51:14)
at async TextChannel.send (/home/runner/B
ot-beta/node_modules/discord.js/src/structure
s/interfaces/TextBasedChannel.js:175:15) {
method: 'post',
path: '/channels/843914213242961940/message
I
code: 50013,
httpStatus: 403,
requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [Array],
components: [Array],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: [Object],
attachments: undefined,
sticker_ids: undefined
},
files: []

Adding data to line chart (chart.js with Vue.js) results in 'too much recursion' error

I'm using chart.js with vue.js. I have a line-chart and I want to add data (later automatically by SSE). I modified another sample, but the error remains the same. It 'crashes' in the call to this.moonData.push (or this.testData.datasets[0].data.push). It must have to do with the ref() of moonData. When I use just the non-ref version, the push succeeds, but the chart isn't updated. BTW, pushing labels succeeds
I'm using chart.js#3.7.0, vue#3.2.29
In Firefox:
Uncaught InternalError: too much recursion
get reactivity.esm-bundler.js:406
toRaw reactivity.esm-bundler.js:927
key reactivity.esm-bundler.js:398
value helpers.segment.js:1554
key reactivity.esm-bundler.js:398
value helpers.segment.js:1554
key reactivity.esm-bundler.js:398
value helpers.segment.js:1554
in chrome:
runtime-core.esm-bundler.js?5c40:218 Uncaught RangeError: Maximum call stack size exceeded
at Object.get (reactivity.esm-bundler.js?a1e9:406:1)
at toRaw (reactivity.esm-bundler.js?a1e9:927:1)
at Proxy.instrumentations.<computed> (reactivity.esm-bundler.js?a1e9:398:1)
at Proxy.value (helpers.segment.js?dd3d:1554:1)
at Proxy.instrumentations.<computed> (reactivity.esm-bundler.js?a1e9:398:1)
at Proxy.value (helpers.segment.js?dd3d:1554:1)
at Proxy.instrumentations.<computed> (reactivity.esm-bundler.js?a1e9:398:1)
at Proxy.value (helpers.segment.js?dd3d:1554:1)
at Proxy.instrumentations.<computed> (reactivity.esm-bundler.js?a1e9:398:1)
at Proxy.value (helpers.segment.js?dd3d:1554:1)
export default defineComponent({
// name: "PlanetChart",
setup() {
let moonData = ref<number[]>([]);
const testData = computed<ChartData<"line">>(() => ({
labels: ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"],
datasets: [
{
label: "Number of Moons",
data: moonData.value,
backgroundColor: "rgba(54,73,93,.5)",
borderColor: "#36495d",
borderWidth: 3,
},
{
label: "Planetary Mass (relative to the Sun x 10^-6)",
data: [0.166, 2.081, 3.003, 0.323, 954.792, 285.886, 43.662, 51.514],
backgroundColor: "rgba(71, 183,132,.5)",
borderColor: "#47b784",
borderWidth: 3,
},
],
}));
const options = ref<ChartOptions<"line">>({
elements: {
line: {
tension: 0,
fill: false,
},
},
scales: {
yAxes: {
ticks: {
padding: 25,
stepSize: 50,
},
},
},
});
return {
testData,
options,
moonData,
};
},
mounted() {
const ctx = document.getElementById("my-planet-chart") as HTMLCanvasElement;
console.log("Found context: ", ctx);
let c = new Chart(ctx, {
type: "line",
data: this.testData,
options: this.options,
});
console.log("Created chart: ", c);
},
methods: {
AddData() {
console.log("Appending data...");
this.moonData.push(Math.round(Math.random() * 1000));
console.log("moonData: ", this.moonData.length);
// this.testData.datasets[0].data.push(Math.round(Math.random() * 1000));
console.log("moonData: ", this.testData.datasets[0].data);
},
},
});
Any ideas?
I had exactly the same problem yesterday. Got it working using a shallowRef instead of a ref.

Testcafe runs on average 2-3 times slower when using SSL

After installing and using a self-signed SSL certificate by following the official guide here and running our test suites it was discovered that the tests take about 3 times as long. I would expect there to maybe be some sort of delay but that's a lot.
Any ideas on why this is the case?
With SSL: 45 passed (6m 56s)
Without SSL: 45 passed (2m 55s)
.testcaferc.js File
let filtered_tests = [
// Located in editor_page_tests.js
'user_is_able_to_add_a_section_column_row_and_element_to_editor',
'pop_up_element_displays_during_page_preview',
'clicking_button_shows_hides_elements',
'user_is_able_to_save_when_adding_a_video',
'user_is_able_to_save_when_leaving_video_embed_blank',
// Located in courses_page_tests.js
'user_can_preview_existing_course',
'optin_user_can_navigate_through_course',
'manually_added_user_can_navigate_through_course',
// Located in funnels_page_tests.js
'user_can_navigate_through_funnel',
// Located in developer_portal_page_tests.js
'user_can_navigate_to_developer_portal_page',
// Located in members_page_tests.js
'user_can_navigate_to_team_members_page',
// Located in teams_dashboard_pages_tests.js
'user_can_navigate_to_team_dashboard_page',
// Located in workspaces_page_tests.js
'user_can_navigate_to_team_workspaces_page'
]
let isolated_tests = [
// Located in sites_overview_page_tests.js
'user_can_make_site_public',
'user_can_edit_site_name',
'user_can_make_site_password_protected',
'user_can_make_site_private',
'user_can_edit_site_domain',
'changing_site_domain_updates_funnel_urls',
// Located in account_details_page_tests.js
'user_can_edit_account_name',
// Located in account_details_page_tests.js
'user_can_edit_account_password',
// Located in general_page_tests.js
'user_can_edit_workspace_details'
]
let full_filter = filtered_tests.concat(isolated_tests)
let build_filter = () => {
// Purpose: To set the suite that we want to run. (Sanity, Smoke, Regression)
var filter = {}
if(process.env.SCOPE) {
filter = {
testGrep: `^(?!.*(${filtered_tests.join('|')})).*$`,
testMeta: {
scope: process.env.SCOPE
}
}
} else {
filter = {
testGrep: `^(?!.*(${full_filter.join('|')})).*$`
}
}
return filter
}
let determine_concurrency = () => {
// Purpose: To set concurrency dependant on the scope that is passed
let concurrency = 5
if (process.env.SCOPE == 'isolated') {
concurrency = 1
}
return concurrency
}
module.exports = {
assertionTimeout: 5000,
browsers: [
"chrome:headless --window-size=1920,1159 --allow-insecure-localhost"
],
concurrency: determine_concurrency(),
cache: true,
clientScripts: "scripts/hide_notifications.js",
filter: build_filter(),
hostname: "localhost",
pageLoadTimeout: 30000,
quarantineMode: {
successThreshold: 1,
attemptLimit: 3
},
reporter: [
{
name: "spec",
output: "artifacts/reports/spec_results"
},
{
name: "xunit",
output: "artifacts/reports/xunit_results.xml"
}
],
screenshots: {
path: "artifacts/screenshots",
pathPattern: "${TEST}_${DATE}_${TIME}.png",
takeOnFails: true,
thumbnails: false
},
selectorTimeout: 5000,
skipJsErrors: true,
skipUncaughtErrors: true,
src: "tests/**",
ssl: {
pfx: "ssl/testingdomain.pfx",
rejectUnauthorized: true
},
videoEncodingOptions: {
aspect: "16:9",
framerate: 30
},
videoOptions: {
failedOnly: true,
pathPattern: "${TEST}_${DATE}_${TIME}.mp4",
singleFile: false
},
videoPath: "artifacts/recordings"
}

can't ascess to field in Ext.form.field.VTypes

This code is working:
Ext.application({
name: 'WebClient',
autoCreateViewport: true,
launch: function() {
Ext.apply(Ext.form.field.VTypes, {
IPAddress: function(v) {
return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(v);
},
IPAddressText: 'Некорректный IP Адресс',
IPAddressMask: /[\d\.]/i
});
Ext.apply(Ext.form.field.VTypes, {
port: function(v) {
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
if (!isNumber(v)) return false;
return (v>=0 && v<=65535)
},
portText: 'Порт 2 байта 0..65535',
portMask: /[\d\.]/i
});
},
models: ['Request','RPCLog','Connection']
});
But if I comment line autoCreateViewport: true, or set this property to false, the browser produces an error: Uncaught TypeError: Cannot read property 'field' of undefined. How to make Ext.form.field.VTypes available without autoCreateViewport:true?
I had the same issue, except that I was defining the custom VType in the view.
Defining the VType inside the initComponent helped resolve the issue.
initComponent : function(){
// Add the additional 'advanced' VTypes
Ext.apply(Ext.form.field.VTypes, {
daterange: function(val, field) {