infor-cloud / m3-h5-sdk

https://infor-cloud.github.io/m3-h5-sdk/
34 stars 20 forks source link

Odin Login - Docker compatibility #141

Open hendric-dev opened 2 years ago

hendric-dev commented 2 years ago

Is your feature request related to a problem? Please describe. I'm developing inside a Docker container using the remote containers feature of vscode. I can't complete the odin login though, since the browser window for authentication won't open. This is caused by the additional sandboxing that happens when launching a browser, which is not possible inside a Docker container. However it can quite easily by solved by adding two additional flags to the Puppeteer launch command.

Describe the solution you'd like It is possible to add the two flags --no-sandbox and --disable-setuid-sandbox to puppeteer.launch. Either as environment variable, CLI parameter or part of the config, whatever fits best.

Additional context Corresponding part of the code: cli/src/commands/login.ts

const browser = await puppeteer.launch({
   headless: false,
   args: [
      `--app=${config.getAuthUrl()}`,
      `--window-size=${WINDOW_WIDTH},${WINDOW_HEIGHT}`,
   ],
   defaultViewport: {
      width: WINDOW_WIDTH,
      height: WINDOW_HEIGHT,
   },
});

I could imagine a solution like:

args: [
   `--app=${config.getAuthUrl()}`,
   `--window-size=${WINDOW_WIDTH},${WINDOW_HEIGHT}`,
].concat(${EXTRA_PUPPETEER_ARGS}),