Failed to launch the browser process! spawn /usr/bin/google-chrome-stable ENOENT\n\n\nTROUBLESHOOTING: - amazon-elastic-beanstalk

here is my sample code ,
this code execute in local without executablePath. But when pass a executablePath and push to elastic beanstalk server then i got this error.
strong text
how do i reslove it?const browser = await puppeteer.launch({     headless: true,   executablePath: '/usr/bin/chromium',     IgnoreHTTPSErrors: true,     args: ["--no-sandbox", "--disable-setuid-sandbox", "--disable-gpu", "--ignore-certificate-errors"],   });

Your executablePath may be wrong, it should be:
executablePath: '/usr/bin/chromium-browser'

Related

Puppeteer when running in full (non-headless) is always black on all websites

I just got started with puppeteer, I'm it on full mode to learn how it works and create my tests. It worked fine for the first few runs but then the browser turns to black.
Here is how it looks like:
I reinstalled all npm packages (removed project and cloned it back from git and then installed them again), this time too it worked for a few runs then I got this black page problem.
const createBrowser = async (
email: string,
proxy?: string
): Promise<puppeteer.Browser> => {
const userDataDir = `profiles/${slugify(email)}`;
const browser = await puppeteer.launch({
headless: process.env.NODE_ENV === "dev",
userDataDir,
args: ["--no-sandbox"]
});
return browser;
};
const createPage = async (
browser: puppeteer.Browser
): Promise<puppeteer.Page> => {
const page = await browser.newPage();
await preparePageForTests(page);
return page;
};
Try to set the defaultViewport property with null value.
const browser = await puppeteer.launch({
headless: process.env.NODE_ENV === "dev",
defaultViewport: null,
args: ["--no-sandbox"],
userDataDir
});

Puppeteer does not run on virtual interface created with netns?

It seems that the puppeteer chrome instance is not started on the virtual interface I created using ip netns. (I run npm on the virtual interface)
What launch parameters do I need?
I launch
sudo ip netns exec ns_clt sudo -u [USER] npm start
that launches puppeteer.
I tried to add userDataDir
const browser = await puppeteer.launch({
headless: true,
executablePath: 'google-chrome',
userDataDir: user_data_dir,
});
SOLUTION:
Use pipe: true!
const browser = await puppeteer.launch({
headless: true,
executablePath: 'google-chrome',
userDataDir: user_data_dir,
pipe: true,
});

puppeteer : launch with no-sandbox and no-headless

I must launch puppeteer with this line:
const browser = await puppeteer.launch({args: ['--no-sandbox']} )
But for debugging, I need launch headless: false
I tested:
const browser = await puppeteer.launch({args: ['--no-sandbox']}
headless: false});
But it doesn't work.
Please help me, thanks.
replace with following code
const browser = await puppeteer.launch({
headless: false,
args: ['--no-sandbox', '--disable-setuid-sandbox']
})

Setting Stormpath Configuration Options

I am trying to customize the registration page with Stormpath and I can't figure out why the configuration options are not working. The enableXXX and requireXXX work, but none of the info inside web:{...} is showing up. I've tried reordering the options, but that doesn't work either.
Specifically, I want to:
-- Register users at /signup instead of /register. Right now only /register is working.
-- I want to redirect them to another site after registration. I randomly put google.com in there, but I'm still redirected to "/" after registration is complete.
-- I want to reorder the registration fields. I want email to be the first field, but username is currently first.
Here's app.js:
// Import required modules.
var express = require('express');
var stormpath = require('express-stormpath');
var path = require('path');
var engine = require('ejs-mate');
var app = express();
// use ejs-locals for all ejs templates:
app.engine('ejs', engine);
// Configure public views
app.set('views','./views');
app.use(stormpath.init(app, {
apiKeyFile: process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'] + ~removed
secretKey: '~removed',
application: '~removed',
enableRegistration: true,
enableGivenName: false,
requireGivenName: false,
enableSurname: false,
requireSurname: false,
website: true,
api: true,
web: {
register: {
uri: '/signup', // Use a different URL
nextUri: 'http://google.com', // Where to send the user to, if auto login is enabled
fields: {
passwordConfirm: {
enabled: true,
required: true
}
},
fieldOrder: [ "email", "username", "password", "passwordConfirm" ],
}
},
enableUsername: true,
requireUsername: true,
enableConfirmPassword: true,
requireConfirmPassword: true
}
));
app.get('/', function(req, res) {
res.render('home.ejs', {
title: 'Welcome'
});
});
app.get('/', function(req, res) {
res.send('home page!');
});
app.listen(process.env.PORT || 3000);
Other possibly relevant info:
-- The site is hosted on Heroku, but I'm not using the Stormpath add-on because I couldn't get it to work.
-- I'm on a Mac.
I've been stuck on this for days and I haven't been able to figure out what I'm doing wrong. Any help would be much appreciated.
The issue is likely this: we released a new version of this library recently which has new configuration options, and it appears you are using our OLD docs as a reference.
Here's what you'll want to do:
Update to the latest express-stormpath release. Then use the code below: (I converted your example to work with the latest release):
app.use(stormpath.init(app, {
client: {
apiKey: {
file: process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'] + '~removed'
}
},
application: {
href: '~removed',
},
web: {
register: {
enabled: true,
uri: '/signup',
nextUri: 'http://google.com', // don't send them here =)
fields: {
username: {
enabled: true,
required: true
},
givenName: {
enabled: false,
required: false
},
surname: {
enabled: false,
required: false
},
passwordConfirm: {
enabled: true,
required: true
}
},
fieldOrder: ['username', 'email', 'password', 'passwordConfirm']
}
},
website: true,
api: true
}));

Sublime Text 2 Snippet returning blank

When I call the snippet below I get blank content instead of the code saved in the snippet. Can someone please tell me what I'm missing? If I replace the code with a string like "foobar" the string displays when I call the snippet. So it seems I'm missing something.
<snippet>
<content>
<![CDATA[
$.ajax({
  url: '/path/to/file',
  type: 'POST',
  dataType: 'xml/html/script/json/jsonp',
  data: {param1: 'value1'},
  complete: function(xhr, textStatus) {
    //called when complete
  },
  success: function(data, textStatus, xhr) {
    //called when successful
  },
  error: function(xhr, textStatus, errorThrown) {
    //called when there is an error
  }
});
]]>
</content>
<tabTrigger>ajax</tabTrigger>
</snippet>
Just escape your jquery call
<snippet>
<content>
<![CDATA[
\$.ajax({
url: '/path/to/file',
type: 'POST',
dataType: 'xml/html/script/json/jsonp',
data: {param1: 'value1'},
complete: function(xhr, textStatus) {
//called when complete
},
success: function(data, textStatus, xhr) {
//called when successful
},
error: function(xhr, textStatus, errorThrown) {
//called when there is an error
}
});
]]>
</content>
<tabTrigger>ajax</tabTrigger>
</snippet>