Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnhandledPromiseRejectionWarning: TypeError: statusFind is not a function #1

Closed
brainwares opened this issue Jun 8, 2020 · 11 comments

Comments

@brainwares
Copy link

Hi,
Trying to create instance with parameter getting error:
UnhandledPromiseRejectionWarning: TypeError: statusFind is not a function
at Object. (/../node_modules/venom-bot/dist/controllers/initializer.js:168:25)

@joedutra
Copy link
Contributor

joedutra commented Jun 8, 2020

he gets in scope now 2 callback

 venom.create("session-develop").then((client) => {
			  start(client)
			}).catch(erro => console.log(erro)) 

OR

venom.create("session-develop", ("statusFind") =>{
console.log(statusFind)
}).then((client) => {
   		  start(client)
   		}).catch(erro => console.log(erro))

OR

venom.create("session-name", (base64Qr, asciiQR) => {
   	
   		console.log(asciiQR);
   		
   	   exportQR(base64Qr, "documentos/qrcode.png");

   	  }, (statusFind) =>{

   		  console.log(statusFind)

   	  }).then((client) => {
   		  start(client)
   		}).catch(erro => console.log(erro))

@brainwares
Copy link
Author

Tried using this sample

create('sessionName', qrCallback, {
headless: true, // Headless chrome
devtools: false, // Open devtools by default
useChrome: true, // If false will use Chromium instance
debug: false, // Opens a debug session
logQR: true // Logs QR automatically in terminal
browserArgs: [''] // Parameters to be added into the chrome browser instance
refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds
});

@orkestral orkestral reopened this Jun 8, 2020
@orkestral
Copy link
Owner

Hello! 5 options:

   venom.create("session-name", {
			headless: true, // Headless chrome
			devtools: false, // Open devtools by default
			useChrome: true, // If false will use Chromium instance
			debug: false, // Opens a debug session
			logQR: true, // Logs QR automatically in terminal
			browserArgs: [''], // Parameters to be added into the chrome browser instance
			refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))
venom.create("session-develop", (base64Qr, asciiQR) => {
   		// To log the QR in the terminal
   		console.log(asciiQR);
   		// To write it somewhere else in a file
   	   exportQR(base64Qr, "documentos/file.png");
   	  }, (statusFind) =>{
   		  console.log(statusFind+'\n\n')
   	  },{
   		headless: true, // Headless chrome
   		devtools: false, // Open devtools by default
   		useChrome: true, // If false will use Chromium instance
   		debug: false, // Opens a debug session
   		logQR: true, // Logs QR automatically in terminal
   		browserArgs: [''], // Parameters to be added into the chrome browser instance
   		refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds
   	  }).then((client) => {
   		  start(client)
   		}).catch(erro => console.log(erro))
 venom.create("session-develop", (base64Qr, asciiQR) => {
			// To log the QR in the terminal
			console.log(asciiQR);
			// To write it somewhere else in a file
		   exportQR(base64Qr, "documentos/file.png");
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))
 venom.create("session-develop",() =>{}, (statusFind) =>{
			  console.log(statusFind+'\n\n')
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))
 venom.create("session-develop").then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

@orkestral
Copy link
Owner

Updated documentation, Thank You!

@brainwares
Copy link
Author

Hello! 5 options:

   venom.create("session-name", {
			headless: true, // Headless chrome
			devtools: false, // Open devtools by default
			useChrome: true, // If false will use Chromium instance
			debug: false, // Opens a debug session
			logQR: true, // Logs QR automatically in terminal
			browserArgs: [''], // Parameters to be added into the chrome browser instance
			refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This is not working. Error result:
TypeError: catchQR is not a function
at SafeSubscriber._next (/.../node_modules/venom-bot/dist/controllers/initializer.js:219:13)

venom.create("session-develop", (base64Qr, asciiQR) => {
   		// To log the QR in the terminal
   		console.log(asciiQR);
   		// To write it somewhere else in a file
   	   exportQR(base64Qr, "documentos/file.png");
   	  }, (statusFind) =>{
   		  console.log(statusFind+'\n\n')
   	  },{
   		headless: true, // Headless chrome
   		devtools: false, // Open devtools by default
   		useChrome: true, // If false will use Chromium instance
   		debug: false, // Opens a debug session
   		logQR: true, // Logs QR automatically in terminal
   		browserArgs: [''], // Parameters to be added into the chrome browser instance
   		refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds
   	  }).then((client) => {
   		  start(client)
   		}).catch(erro => console.log(erro))

Not working also
ReferenceError: exportQR is not defined

 venom.create("session-develop", (base64Qr, asciiQR) => {
			// To log the QR in the terminal
			console.log(asciiQR);
			// To write it somewhere else in a file
		   exportQR(base64Qr, "documentos/file.png");
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

Same Error...
Not working also
ReferenceError: exportQR is not defined

 venom.create("session-develop",() =>{}, (statusFind) =>{
			  console.log(statusFind+'\n\n')
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This Sample is working, but I need to set the debug parameters to be true.

 venom.create("session-develop").then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This is working, but need debug parameters to be true

@orkestral
Copy link
Owner

orkestral commented Jun 8, 2020

Hello! 5 options:

   venom.create("session-name", {
			headless: true, // Headless chrome
			devtools: false, // Open devtools by default
			useChrome: true, // If false will use Chromium instance
			debug: false, // Opens a debug session
			logQR: true, // Logs QR automatically in terminal
			browserArgs: [''], // Parameters to be added into the chrome browser instance
			refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This is not working. Error result:
TypeError: catchQR is not a function
at SafeSubscriber._next (/.../node_modules/venom-bot/dist/controllers/initializer.js:219:13)

venom.create("session-develop", (base64Qr, asciiQR) => {
   		// To log the QR in the terminal
   		console.log(asciiQR);
   		// To write it somewhere else in a file
   	   exportQR(base64Qr, "documentos/file.png");
   	  }, (statusFind) =>{
   		  console.log(statusFind+'\n\n')
   	  },{
   		headless: true, // Headless chrome
   		devtools: false, // Open devtools by default
   		useChrome: true, // If false will use Chromium instance
   		debug: false, // Opens a debug session
   		logQR: true, // Logs QR automatically in terminal
   		browserArgs: [''], // Parameters to be added into the chrome browser instance
   		refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds
   	  }).then((client) => {
   		  start(client)
   		}).catch(erro => console.log(erro))

Not working also
ReferenceError: exportQR is not defined

 venom.create("session-develop", (base64Qr, asciiQR) => {
			// To log the QR in the terminal
			console.log(asciiQR);
			// To write it somewhere else in a file
		   exportQR(base64Qr, "documentos/file.png");
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

Same Error...
Not working also
ReferenceError: exportQR is not defined

 venom.create("session-develop",() =>{}, (statusFind) =>{
			  console.log(statusFind+'\n\n')
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This Sample is working, but I need to set the debug parameters to be true.

 venom.create("session-develop").then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This is working, but need debug parameters to be true

It is not normal to work this example which is just an example, but it is not a qr function, now and with you, here is only taught how to mess with the repo, more follows a part of the code:

function exportQR(qrCode, path) {
			  qrCode = qrCode.replace("data:image/png;base64,", "");
			  const imageBuffer = Buffer.from(qrCode, "base64");
			
			  // Creates "marketing-qr.png" file
			  fs.writeFileSync(path, imageBuffer);
			}

look the documentation

@brainwares
Copy link
Author

Hello! 5 options:

   venom.create("session-name", {
			headless: true, // Headless chrome
			devtools: false, // Open devtools by default
			useChrome: true, // If false will use Chromium instance
			debug: false, // Opens a debug session
			logQR: true, // Logs QR automatically in terminal
			browserArgs: [''], // Parameters to be added into the chrome browser instance
			refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This is not working. Error result:
TypeError: catchQR is not a function
at SafeSubscriber._next (/.../node_modules/venom-bot/dist/controllers/initializer.js:219:13)

venom.create("session-develop", (base64Qr, asciiQR) => {
   		// To log the QR in the terminal
   		console.log(asciiQR);
   		// To write it somewhere else in a file
   	   exportQR(base64Qr, "documentos/file.png");
   	  }, (statusFind) =>{
   		  console.log(statusFind+'\n\n')
   	  },{
   		headless: true, // Headless chrome
   		devtools: false, // Open devtools by default
   		useChrome: true, // If false will use Chromium instance
   		debug: false, // Opens a debug session
   		logQR: true, // Logs QR automatically in terminal
   		browserArgs: [''], // Parameters to be added into the chrome browser instance
   		refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds
   	  }).then((client) => {
   		  start(client)
   		}).catch(erro => console.log(erro))

Not working also
ReferenceError: exportQR is not defined

 venom.create("session-develop", (base64Qr, asciiQR) => {
			// To log the QR in the terminal
			console.log(asciiQR);
			// To write it somewhere else in a file
		   exportQR(base64Qr, "documentos/file.png");
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

Same Error...
Not working also
ReferenceError: exportQR is not defined

 venom.create("session-develop",() =>{}, (statusFind) =>{
			  console.log(statusFind+'\n\n')
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This Sample is working, but I need to set the debug parameters to be true.

 venom.create("session-develop").then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This is working, but need debug parameters to be true

It is not normal to work this example which is just an example, but it is not a qr function, now and with you, here is only taught how to mess with the repo, more follows a part of the code:

function exportQR(qrCode, path) {
			  qrCode = qrCode.replace("data:image/png;base64,", "");
			  const imageBuffer = Buffer.from(qrCode, "base64");
			
			  // Creates "marketing-qr.png" file
			  fs.writeFileSync(path, imageBuffer);
			}

look the documentation

It's working now, thanks!
In the
console.log(statusFind+'\n\n')
doesn't seem to return any value, is that right?

@orkestral
Copy link
Owner

Hello! 5 options:

   venom.create("session-name", {
			headless: true, // Headless chrome
			devtools: false, // Open devtools by default
			useChrome: true, // If false will use Chromium instance
			debug: false, // Opens a debug session
			logQR: true, // Logs QR automatically in terminal
			browserArgs: [''], // Parameters to be added into the chrome browser instance
			refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This is not working. Error result:
TypeError: catchQR is not a function
at SafeSubscriber._next (/.../node_modules/venom-bot/dist/controllers/initializer.js:219:13)

venom.create("session-develop", (base64Qr, asciiQR) => {
   		// To log the QR in the terminal
   		console.log(asciiQR);
   		// To write it somewhere else in a file
   	   exportQR(base64Qr, "documentos/file.png");
   	  }, (statusFind) =>{
   		  console.log(statusFind+'\n\n')
   	  },{
   		headless: true, // Headless chrome
   		devtools: false, // Open devtools by default
   		useChrome: true, // If false will use Chromium instance
   		debug: false, // Opens a debug session
   		logQR: true, // Logs QR automatically in terminal
   		browserArgs: [''], // Parameters to be added into the chrome browser instance
   		refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds
   	  }).then((client) => {
   		  start(client)
   		}).catch(erro => console.log(erro))

Not working also
ReferenceError: exportQR is not defined

 venom.create("session-develop", (base64Qr, asciiQR) => {
			// To log the QR in the terminal
			console.log(asciiQR);
			// To write it somewhere else in a file
		   exportQR(base64Qr, "documentos/file.png");
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

Same Error...
Not working also
ReferenceError: exportQR is not defined

 venom.create("session-develop",() =>{}, (statusFind) =>{
			  console.log(statusFind+'\n\n')
		  }).then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This Sample is working, but I need to set the debug parameters to be true.

 venom.create("session-develop").then((client) => {
			  start(client)
			}).catch(erro => console.log(erro))

This is working, but need debug parameters to be true

It is not normal to work this example which is just an example, but it is not a qr function, now and with you, here is only taught how to mess with the repo, more follows a part of the code:

function exportQR(qrCode, path) {
			  qrCode = qrCode.replace("data:image/png;base64,", "");
			  const imageBuffer = Buffer.from(qrCode, "base64");
			
			  // Creates "marketing-qr.png" file
			  fs.writeFileSync(path, imageBuffer);
			}

look the documentation

It's working now, thanks!
In the
console.log(statusFind+'\n\n')
doesn't seem to return any value, is that right?

Callback Status Session
Gets the return if the session is isLogged or if it is notLogged

create('sessionName', qrCallback, (statusFind) => {
  console.log(statusFind);
})
  .then((client) => {
    start(client);
  })
  .catch((erro) => console.log(erro));

@brainwares
Copy link
Author

Callback Status Session
Gets the return if the session is isLogged or if it is notLogged

create('sessionName', qrCallback, (statusFind) => {
  console.log(statusFind);
})
  .then((client) => {
    start(client);
  })
  .catch((erro) => console.log(erro));

Screen Shot 2020-06-09 at 02 27 50

I don't see the Status Session logged in the console.

@orkestral
Copy link
Owner

here working, update npm venom-bot

image

@brainwares
Copy link
Author

here working, update npm venom-bot

image

Very nice!
It is working now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants