scully: Build never completes in a Bitbucket Pipeline

🐞 Bug report

Description

I am running into some issues with the scully build inside a Bitbucket Pipeline. npm run scully never finishes; gets stuck, here are the logs:

mtna-scully-seed-ui@0.0.0 scully /opt/atlassian/pipelines/agent/build
> scully "--host=0.0.0.0" "--scanRoutes"
 ☺   new Angular build imported
 ☺   Started servers in background
Finding all routes in application.
traversing app for routes
Pull in data to create additional routes.
Route list created in files:
  "./dist/static/assets/scully-routes.json",
  "/opt/atlassian/pipelines/agent/build/dist/mtna-scully-seed-ui/assets/scully-routes.json",
  "/opt/atlassian/pipelines/agent/build/src/assets/scully-routes.json"

I have tried with no argument, with host & scanRoutes with no effect. I have also tried using the regular ng build instead of prod, also no difference.

Thanks for the help, love the project!

🔬 Minimal Reproduction

I have created an open BB repo to demonstrate: https://bitbucket.org/wallace41290/scully-pipeline-test

If you want to take a look at the existing pipelines there is one in there that I stopped, because I didn’t want it to eat through all my minutes. Or fork the repo and give it a try yourself.

💻Your Environment

Angular Version:


Your global Angular CLI version (10.0.2) is greater than your local
version (9.1.12). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 9.1.12
Node: 12.16.1
OS: darwin x64

Angular: 9.1.12
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.12
@angular-devkit/build-angular     0.901.12
@angular-devkit/build-optimizer   0.901.12
@angular-devkit/build-webpack     0.901.12
@angular-devkit/core              9.1.12
@angular-devkit/schematics        9.1.12
@ngtools/webpack                  9.1.12
@schematics/angular               9.1.12
@schematics/update                0.901.12
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

Scully Version:


{
  "name": "scully-pipeline-test",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build:prod": "ng build --prod --base-href / && npm run scully",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "scully": "scully",
    "scully:serve": "scully serve"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~9.1.12",
    "@angular/common": "~9.1.12",
    "@angular/compiler": "~9.1.12",
    "@angular/core": "~9.1.12",
    "@angular/forms": "~9.1.12",
    "@angular/platform-browser": "~9.1.12",
    "@angular/platform-browser-dynamic": "~9.1.12",
    "@angular/router": "~9.1.12",
    "@scullyio/init": "^1.0.0-beta.0",
    "@scullyio/ng-lib": "^1.0.0-beta.0",
    "@scullyio/scully": "^1.0.0-beta.0",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.901.12",
    "@angular/cli": "~9.1.12",
    "@angular/compiler-cli": "~9.1.12",
    "@types/node": "^12.11.1",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~3.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~3.8.3"
  }
}

🔥 Exception or Error




About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 15 (5 by maintainers)

Most upvoted comments

This took me nearly two hours to figure out, so I hope someone else benefits from this too. I have kept on wondering why Vercel’s example repository for Scully worked while mine did not with the following error:

15:57:22.702 | =================================================================================================
15:57:22.702 | Puppeteer cannot find or launch the browser. (by default chrome)
15:57:22.702 | Try adding 'puppeteerLaunchOptions: {executablePath: CHROMIUM_PATH}'
15:57:22.703 | to your scully.*.config.ts file.
15:57:22.703 | Also, this might happen because the default timeout (60 seconds) is to short on this system
15:57:22.703 | this can be fixed by adding the --serverTimeout=x cmd line option.
15:57:22.703 | (where x = the new timeout in milliseconds)
15:57:22.703 | When this happens in CI/CD you can find some additional information here:
15:57:22.703 | https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
15:57:22.703 | =================================================================================================

I downgraded Scully in my repository (mine is 1.1.4 while the example repository uses 1.1.1), installed puppeteer manually with npm i -D puppeteer and even tried alixaxel/chrome-aws-lambda without any luck. (Just in case you think about going down these paths too.) In the end, what caused the build process to succeed were the following changes:

diff --git a/scully.fuw.config.ts b/scully.fuw.config.ts
index 9f41e82..3f18f97 100644
--- a/scully.fuw.config.ts
+++ b/scully.fuw.config.ts
@@ -1,8 +1,10 @@
 import { ScullyConfig } from '@scullyio/scully';
 export const config: ScullyConfig = {
-  projectRoot: "./src",
-  projectName: "fuw",
+  projectRoot: './src',
+  projectName: 'fuw',
   outDir: './dist/static',
-  routes: {
-  }
-};
\ No newline at end of file
+  routes: {},
+  puppeteerLaunchOptions: {
+    args: ['--no-sandbox', '--disable-setuid--sandbox'],
+  },
+};

So it turns out adding --no-sandbox and --disable-setuid-sandbox does the trick. This is also mentioned in https://github.com/scullyio/scully/issues/924#issuecomment-693383520 but just to make it clear here too.

Getting the same issue over here.

This took me nearly two hours to figure out, so I hope someone else benefits from this too. I have kept on wondering why Vercel’s example repository for Scully worked while mine did not with the following error:

15:57:22.702 | =================================================================================================
15:57:22.702 | Puppeteer cannot find or launch the browser. (by default chrome)
15:57:22.702 | Try adding 'puppeteerLaunchOptions: {executablePath: CHROMIUM_PATH}'
15:57:22.703 | to your scully.*.config.ts file.
15:57:22.703 | Also, this might happen because the default timeout (60 seconds) is to short on this system
15:57:22.703 | this can be fixed by adding the --serverTimeout=x cmd line option.
15:57:22.703 | (where x = the new timeout in milliseconds)
15:57:22.703 | When this happens in CI/CD you can find some additional information here:
15:57:22.703 | https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
15:57:22.703 | =================================================================================================

I downgraded Scully in my repository (mine is 1.1.4 while the example repository uses 1.1.1), installed puppeteer manually with npm i -D puppeteer and even tried alixaxel/chrome-aws-lambda without any luck. (Just in case you think about going down these paths too.) In the end, what caused the build process to succeed were the following changes:

diff --git a/scully.fuw.config.ts b/scully.fuw.config.ts
index 9f41e82..3f18f97 100644
--- a/scully.fuw.config.ts
+++ b/scully.fuw.config.ts
@@ -1,8 +1,10 @@
 import { ScullyConfig } from '@scullyio/scully';
 export const config: ScullyConfig = {
-  projectRoot: "./src",
-  projectName: "fuw",
+  projectRoot: './src',
+  projectName: 'fuw',
   outDir: './dist/static',
-  routes: {
-  }
-};
\ No newline at end of file
+  routes: {},
+  puppeteerLaunchOptions: {
+    args: ['--no-sandbox', '--disable-setuid--sandbox'],
+  },
+};

So it turns out adding --no-sandbox and --disable-setuid-sandbox does the trick. This is also mentioned in #924 (comment) but just to make it clear here too.

Thanks! This helped me. I was having an issue with builds on netlify so I had to move to vercel and then encountered that error. Now I’m back up!

@niklaas I’ll add the puppeteer options to the faq page in #1379 Thanks for letting us know