gulp-angular-protractor crashes with error code 135 - angularjs

I'm trying to run some e2e tests on an Angular 1.x system, but whenever I try to run gulp-angular-protractor tests I get this error:
[TIME] E/launcher - Process exited with error code 135
[TIME] gulp-angular-protractor - An error occured to stop the Webdriver standalone server
Here are the packages I have installed:
Local
├── angular#1.6.4
├── angular-animate#1.6.4
├── angular-aria#1.6.4
├── angular-cookies#1.6.4
├── angular-local-storage#0.5.2
├── angular-material#1.1.4
├── angular-messages#1.6.4
├── angular-mocks#1.6.4
├── angular-paging#2.2.2
├── angular-poller#0.4.5
├── angular-sanitize#1.6.4
├── angular-svg-round-progressbar#0.4.8
├── angular-translate#2.15.1
├── angular-translate-loader-partial#2.15.1
├── angular-ui-router#1.0.3
├── angular-wizard#0.10.0
├── angulartics#1.4.0
├── angulartics-google-analytics#0.4.0
├── babel-core#6.24.1
├── babel-eslint#7.2.3
├── babel-loader#6.4.1
├── babel-plugin-transform-runtime#6.23.0
├── babel-polyfill#6.23.0
├── babel-preset-es2015#6.24.1
├── babel-preset-stage-0#6.24.1
├── babel-register#6.24.1
├── babel-runtime#6.23.0
├── browser-sync#2.18.8
├── browserify-sign#4.0.0
├── buffer-loader#0.0.1
├── chai#3.5.0
├── checklist-model#0.10.0
├── connect-history-api-fallback#1.3.0
├── constants#0.0.2
├── copy-webpack-plugin#4.0.1
├── crypto-browserify#3.11.0
├── crypto-js#3.1.9-1
├── css-loader#0.26.4
├── del#2.2.2
├── eslint#3.19.0
├── eslint-plugin-angular#1.6.4
├── file-loader#0.10.1
├── fingerprintjs2#1.5.1
├── fs-walk#0.0.1
├── git-rev-sync#1.9.1
├── gulp#3.9.1
├── gulp-angular-protractor#1.0.0
├── gulp-ng-constant#2.0.0-2
├── gulp-rename#1.2.2
├── gulp-replace#0.5.4
├── gulp-template#4.0.0
├── gulp-util#3.0.8
├── html-webpack-plugin#2.28.0
├── image-webpack-loader#3.3.1
├── json-override#0.2.0
├── karma#1.7.0
├── karma-chai#0.1.0
├── karma-chrome-launcher#2.1.1
├── karma-mocha#1.3.0
├── karma-mocha-reporter#2.2.3
├── karma-sourcemap-loader#0.3.7
├── karma-webpack#1.8.1
├── lodash#4.17.4
├── mocha#3.3.0
├── ng-annotate-loader#0.2.0
├── ngmap#1.17.8
├── node-libs-browser#2.0.0
├── node-rsa#0.4.2
├── protractor#5.1.1
├── raw-loader#0.5.1
├── style-loader#0.13.2
├── stylus#0.54.5
├── stylus-loader#2.5.1
├── supports-color#3.2.3
├── ua-parser-js#0.7.12
├── v-accordion#1.6.0
├── webdriver-manager#12.0.6
├── webpack#1.15.0
├── webpack-dev-middleware#1.10.2
├── webpack-hot-middleware#2.18.0
└── yargs#6.6.0
Global
├── gulp#3.9.1
├── karma#1.7.0
├── karma-cli#1.0.1
├── n#2.1.7
├── npm#3.10.10
└── webpack#2.5.1
And here is the full error log I got when I ran the protractor gulp task:
NickF$ gulp protractor
[14:04:26] Requiring external module babel-register
[14:04:27] Using gulpfile ~/WebstormProjects/phoenix-web/gulpfile.babel.js
[14:04:27] Starting 'protractor'...
[14:04:27] gulp-angular-protractor - The plugin is retrieved and will start soon
[14:04:27] gulp-angular-protractor - We will try to start and stop automatically the WebDriver server
[14:04:28] gulp-angular-protractor - The selenium address is: http://localhost:4444/wd/hub
[14:04:28] gulp-angular-protractor - The selenium address used is: http://localhost:4444/wd/hub
[14:04:28] gulp-angular-protractor - The selenium shutdown address used is: http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer
[14:04:28] gulp-angular-protractor - We have the config file to the following path: /Users/NickF/WebstormProjects/phoenix-web/protractor.config.js
[14:04:28] gulp-angular-protractor - Webdriver standalone will be updated
[14:04:28] I/file_manager - creating folder /Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium
[14:04:45] I/update - chromedriver: unzipping chromedriver_2.29.zip
[14:04:45] I/update - chromedriver: setting permissions to 0755 for /Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium/chromedriver_2.29
[14:04:53] I/update - geckodriver: unzipping geckodriver-v0.16.1.tar.gz
[14:04:53] I/update - geckodriver: setting permissions to 0755 for /Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium/geckodriver-v0.16.1
[14:04:55] gulp-angular-protractor - Webdriver standalone is updated
[14:04:55] gulp-angular-protractor - Webdriver standalone server will be started
[14:04:56] [14:04:56] I/start - java -Dwebdriver.chrome.driver=/Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium/chromedriver_2.29 -Dwebdriver.gecko.driver=/Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium/geckodriver-v0.16.1 -jar /Users/NickF/WebstormProjects/phoenix-web/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.4.0.jar -port 4444
[14:04:56] [14:04:56] I/start - seleniumProcess.pid: 6487
[14:04:56] 14:04:56.915 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
[14:04:56] 14:04:56.916 INFO - Launching a standalone Selenium Server
[14:04:56] 2017-05-10 14:04:56.955:INFO::main: Logging initialized #362ms to org.seleniumhq.jetty9.util.log.StdErrLog
[14:04:56]
[14:04:57] 14:04:57.054 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
[14:04:57] 14:04:57.055 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC
[14:04:57] 14:04:57.056 INFO - Driver class not found: com.opera.core.systems.OperaDriver
[14:04:57] 14:04:57.056 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
[14:04:57] 14:04:57.057 INFO - Driver class not found: com.opera.core.systems.OperaDriver
[14:04:57] 14:04:57.057 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
[14:04:57] 2017-05-10 14:04:57.144:INFO:osjs.Server:main: jetty-9.4.3.v20170317
[14:04:57]
[14:04:57] 2017-05-10 14:04:57.214:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler#d8355a8{/,null,AVAILABLE}
[14:04:57]
[14:04:57] 2017-05-10 14:04:57.285:INFO:osjs.AbstractConnector:main: Started ServerConnector#146ba0ac{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
[14:04:57]
[14:04:57] 2017-05-10 14:04:57.289:INFO:osjs.Server:main: Started #696ms
[14:04:57] 14:04:57.289 INFO - Selenium Server is up and running
[14:04:57] gulp-angular-protractor - Webdriver standalone server is started
[14:04:57] gulp-angular-protractor - We will run the Protractor engine
[14:04:58] D/launcher - Running with --troubleshoot
[14:04:58] D/launcher - Protractor version: 5.1.1
[14:04:58] D/launcher - Your base url for tests is http://localhost:80
[14:04:58] I/launcher - Running 1 instances of WebDriver
[14:04:58] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[14:04:58] E/launcher - Error code: 135
[14:04:58] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED ::1:4444
[14:04:58] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED ::1:4444
at ClientRequest.<anonymous> (/Users/NickF/WebstormProjects/phoenix-web/node_modules/selenium-webdriver/http/index.js:238:15)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:309:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1277:8)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
From: Task: WebDriver.createSession()
at Function.createSession (/Users/NickF/WebstormProjects/phoenix-web/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
at Function.createSession (/Users/NickF/WebstormProjects/phoenix-web/node_modules/selenium-webdriver/chrome.js:709:29)
at createDriver (/Users/NickF/WebstormProjects/phoenix-web/node_modules/selenium-webdriver/index.js:167:33)
at Builder.build (/Users/NickF/WebstormProjects/phoenix-web/node_modules/selenium-webdriver/index.js:623:16)
at Hosted.getNewDriver (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/lib/driverProviders/driverProvider.ts:60:29)
at Runner.createBrowser (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/lib/runner.ts:225:39)
at q.then.then (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/lib/runner.ts:391:27)
at _fulfilled (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/NickF/WebstormProjects/phoenix-web/node_modules/protractor/node_modules/q/q.js:796:13)
[14:04:58] E/launcher - Process exited with error code 135
[14:04:58] gulp-angular-protractor - An error occured to stop the Webdriver standalone server
{ [Error: protractor exited with code 135]
message: 'protractor exited with code 135',
showStack: false,
showProperties: true,
plugin: 'gulp-angular-protractor',
__safety: { toString: [Function: bound ] } }
Lastly, my versions:
Node: 6.10.3
NPM: 4.5.0
OS: Mac OS 10.12.4
Tried to resolve by running the webdriver-manager and then opening a session from the selenium localhost page, webdriver regurgitated this error:
15:16:41.900 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'Nick-Fittons-MacBook-Pro.local', ip: 'fe80:0:0:0:ceb:b88:ae4e:7257%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.4', java.version: '1.8.0_131'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:131)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:36)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:190)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:222)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:184)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:150)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:841)
at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:543)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1228)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:481)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1130)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.seleniumhq.jetty9.server.Server.handle(Server.java:564)
at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:320)
at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:112)
at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'Nick-Fittons-MacBook-Pro.local', ip: 'fe80:0:0:0:ceb:b88:ae4e:7257%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.4', java.version: '1.8.0_131'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:110)
at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:96)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:209)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
... 1 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:102)
... 9 more
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'Nick-Fittons-MacBook-Pro.local', ip: 'fe80:0:0:0:ceb:b88:ae4e:7257%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.4', java.version: '1.8.0_131'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:658)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:184)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:148)
... 14 more
Caused by: java.lang.IllegalStateException: The process has not exited yet therefore no result is available ...
at org.apache.commons.exec.DefaultExecuteResultHandler.getException(DefaultExecuteResultHandler.java:76)
at org.openqa.selenium.os.UnixProcess.checkForError(UnixProcess.java:174)
at org.openqa.selenium.os.CommandLine.checkForError(CommandLine.java:183)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:192)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:181)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
... 19 more
15:16:41.919 WARN - Exception: The process has not exited yet therefore no result is available ...
If anyone could shine a light on what I'm doing wrong it would be much appreciated!

The problem I had was that localhost was not directed properly.
Make sure you have a link to localhost in /private/etc/hosts
Because I didn't...

Related

Serving a Vite.js React project with a FastAPI backend via Docker

I have a project that uses a fastapi backend and a vite.js React front end. I currently have each dockerized as image.
Is there a way I can get fastapi to serve the vite projects static files so I don't have to have two images.
I have seen this https://fastapi.tiangolo.com/tutorial/static-files/ but not sure if that's what I need or would it be like
from fastapi.staticfiles import StaticFiles
load_dotenv() # take environment variables from .env.
app = FastAPI()
# serves static files from the /frontend/dist directory
app.mount("/frontend", StaticFiles(directory="frontend/dist"), name="frontend")
I have ran the above and got error RuntimeError: Directory 'frontend/dist' does not exist
I have my vite project in frontend I ran the vite build command which produced a dist folder with my static files inside. This is my current structure
.
├── README.md
├── backend
│ ├── Dockerfile
│ ├── Pipfile
│ ├── Pipfile.lock
│ └── main.py
└── frontend
├── Dockerfile
├── dist
│ ├── assets
│ │ ├── favicon.17e50649.svg
│ │ ├── index.1cd49a68.js
│ │ └── index.30ea237b.css
│ └── index.html
├── index.html
├── package-lock.json
├── package.json
├── postcss.config.js
├── src
│ ├── App.jsx
│ ├── favicon.svg
│ ├── index.css
│ ├── logo.svg
│ └── main.jsx
├── tailwind.config.js
└── vite.config.js
After MadsLindh suggested the change, I was able to start the fastapi server from within the backend directory but now I get
> uvicorn main:app --reload
INFO: Will watch for changes in these directories: ['/Users/paul/Desktop/deal_query_ui/backend']
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [79530] using WatchFiles
INFO: Started server process [79532]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: 127.0.0.1:63011 - "GET / HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:63012 - "GET /apple-touch-icon-precomposed.png HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:63012 - "GET /apple-touch-icon.png HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:63013 - "GET /favicon.ico HTTP/1.1" 404 Not Found
I even tried to go to http://127.0.0.1:8000/frontend/ but nothing I get the same {"detail":"Not Found"}
Docker
I went on to then create a Dockerfile within the root
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.8-slim
EXPOSE 80
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Install pip requirements
COPY ./backend/Pipfile ./backend/Pipfile.lock ./
RUN python -m pip install --upgrade pip
RUN pip install pipenv && pipenv install --dev --system --deploy
WORKDIR /app
COPY . /app
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "80"]
When running this locally I get the error
Traceback (most recent call last):
File "/usr/local/bin/uvicorn", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 407, in main
run(
File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 575, in run
server.run()
File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 67, in serve
config.load()
File "/usr/local/lib/python3.8/site-packages/uvicorn/config.py", line 479, in load
self.loaded_app = import_from_string(self.app)
File "/usr/local/lib/python3.8/site-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/./backend/main.py", line 14, in <module>
app.mount("/frontend", StaticFiles(directory="../frontend/dist"), name="frontend")
File "/usr/local/lib/python3.8/site-packages/starlette/staticfiles.py", line 55, in __init__
raise RuntimeError(f"Directory '{directory}' does not exist")
RuntimeError: Directory '../frontend/dist' does not exist
Which from my experience doesn't make sense to me as I could get the server up and running from within the BE directory.

Ingress configuration as String with Flink statefun

What I am trying to do
Once followed the python walkthrough I am trying to modify module.yaml file so ingress and egress is not Protobuf but String. I have not really modify most of the files, only module.yaml trying to configure for string ingress and greeter.py to not take into account either state or protobuf messages and only to print the input received from the ingress.
The architecture of the project has not being changed:
$ tree statefun-walkthrough
statefun-walkthrough
├── Dockerfile
├── docker-compose.yml
├── generator
│ ├── Dockerfile
│ ├── event-generator.py
│ └── messages_pb2.py
├── greeter
│ ├── Dockerfile
│ ├── greeter.py
│ ├── messages.proto
│ ├── messages_pb2.py
│ └── requirements.txt
└── module.yaml
The used configuration files and python application:
docker-compose.yml
version: "2.1"
services:
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka-broker:
image: wurstmeister/kafka:2.12-2.0.1
ports:
- "9092:9092"
environment:
HOSTNAME_COMMAND: "route -n | awk '/UG[ \t]/{print $$2}'"
KAFKA_CREATE_TOPICS: "names:1:1,greetings:1:1"
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
depends_on:
- zookeeper
volumes:
- /var/run/docker.sock:/var/run/docker.sock
master: # for flink-statefun
build:
context: .
expose:
- "6123"
ports:
- "8081:8081"
environment:
- ROLE=master
- MASTER_HOST=master
volumes:
- ./checkpoint-dir:/checkpoint-dir
worker: # for flink-statefun
build:
context: .
expose:
- "6121"
- "6122"
depends_on:
- master
- kafka-broker
links:
- "master:master"
- "kafka-broker:kafka-broker"
environment:
- ROLE=worker
- MASTER_HOST=master
volumes:
- ./checkpoint-dir:/checkpoint-dir
python-worker: # greeter application
build:
context: ./greeter
expose:
- "8000"
event-generator: # reading and writting in kafka topic
build:
context: generator
dockerfile: Dockerfile
depends_on:
- kafka-broker
module.yaml
version: "1.0"
module:
meta:
type: remote
spec:
functions:
- function:
meta:
kind: http
type: example/greeter
spec:
endpoint: http://python-worker:8000/statefun
maxNumBatchRequests: 500
timeout: 2min
ingresses:
- ingress:
meta:
type: statefun.kafka.io/ingress
id: example/names
spec:
address: kafka-broker:9092
consumerGroupId: my-group-id
topics:
- topic: names
valueType: io.statefun.types/string
targets:
- example/greeter
egresses:
- egress:
meta:
type: statefun.kafka.io/egress
id: example/greets
spec:
address: kafka-broker:9092
deliverySemantic:
type: exactly-once
transactionTimeoutMillis: 100000
greeter.py
from statefun import StatefulFunctions
from statefun import RequestReplyHandler
from statefun import kafka_egress_record
functions = StatefulFunctions()
#functions.bind("example/greeter")
def greet(context, message):
print(type(message), message)
handler = RequestReplyHandler(functions)
#
# Serve the endpoint
#
from flask import request
from flask import make_response
from flask import Flask
app = Flask(__name__)
#app.route('/statefun', methods=['POST'])
def handle():
response_data = handler(request.data)
response = make_response(response_data)
response.headers.set('Content-Type', 'application/octet-stream')
return response
if __name__ == "__main__":
app.run()
The error
After running docker-compose up -d --build flink master stops with the next error:
2022-02-14 18:11:14,795 INFO org.apache.flink.runtime.entrypoint.ClusterEntrypoint [] - Shutting StatefulFunctionsClusterEntryPoint down with application status FAILED. Diagnostics org.apache.flink.util.FlinkException: Could not create the DispatcherResourceManagerComponent.
at org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:256)
at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runCluster(ClusterEntrypoint.java:219)
at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.lambda$startCluster$0(ClusterEntrypoint.java:172)
at org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30)
at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.startCluster(ClusterEntrypoint.java:171)
at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runClusterEntrypoint(ClusterEntrypoint.java:520)
at org.apache.flink.statefun.flink.launcher.StatefulFunctionsClusterEntryPoint.main(StatefulFunctionsClusterEntryPoint.java:99)
Caused by: org.apache.flink.util.FlinkRuntimeException: Could not retrieve the JobGraph.
at org.apache.flink.runtime.dispatcher.runner.JobDispatcherLeaderProcessFactoryFactory.createFactory(JobDispatcherLeaderProcessFactoryFactory.java:57)
at org.apache.flink.runtime.dispatcher.runner.DefaultDispatcherRunnerFactory.createDispatcherRunner(DefaultDispatcherRunnerFactory.java:51)
at org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:194)
... 6 more
Caused by: org.apache.flink.util.FlinkException: Could not create the JobGraph from the provided user code jar.
at org.apache.flink.statefun.flink.launcher.StatefulFunctionsJobGraphRetriever.retrieveJobGraph(StatefulFunctionsJobGraphRetriever.java:107)
at org.apache.flink.runtime.dispatcher.runner.JobDispatcherLeaderProcessFactoryFactory.createFactory(JobDispatcherLeaderProcessFactoryFactory.java:55)
... 8 more
Caused by: org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: There are no routers defined.
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:302)
at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:198)
at org.apache.flink.client.program.PackagedProgramUtils.getPipelineFromProgram(PackagedProgramUtils.java:150)
at org.apache.flink.client.program.PackagedProgramUtils.createJobGraph(PackagedProgramUtils.java:77)
at org.apache.flink.statefun.flink.launcher.StatefulFunctionsJobGraphRetriever.retrieveJobGraph(StatefulFunctionsJobGraphRetriever.java:101)
... 9 more
Caused by: java.lang.IllegalStateException: There are no routers defined.
at org.apache.flink.statefun.flink.core.StatefulFunctionsUniverseValidator.validate(StatefulFunctionsUniverseValidator.java:31)
at org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:76)
at org.apache.flink.statefun.flink.core.StatefulFunctionsJob.main(StatefulFunctionsJob.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:288)
... 13 more
I do not know if this Exception Caused by: org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: There are no routers defined. is the main problem and why is it happening.

SonarQube don't start

I'm trying to install SonarQube on my CentOS7 server.
When i try to access via web I see this:
web_page
It's supposed to show a SonarQube page right??
Here i put my logs and configs:
web.log:
2019.08.29 17:24:54 INFO web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2019.08.29 17:25:05 INFO web[][o.s.p.ProcessEntryPoint] Starting web
2019.08.29 17:25:05 INFO web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2019.08.29 17:25:06 INFO web[][o.e.plugins] [Kurt Wagner] modules [], plugins [], sites []
2019.08.29 17:25:06 INFO web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2019.08.29 17:25:06 INFO web[][o.s.s.p.LogServerVersion] SonarQube Server / 6.4.0.25310 / ad64a17b531c0e1f6fef0ce7e4d0d0b060977754
2019.08.29 17:25:06 INFO web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://localhost/sonar
2019.08.29 17:25:06 ERROR web[][o.s.s.p.Platform] Web server startup failed
java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:108)
at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
at org.sonar.core.platform.ComponentContainer$1.start(ComponentContainer.java:320)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:88)
at org.sonar.server.platform.Platform.start(Platform.java:231)
at org.sonar.server.platform.Platform.startLevel1Container(Platform.java:190)
at org.sonar.server.platform.Platform.init(Platform.java:86)
at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5189)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (FATAL: password authentication failed for user "sonar")
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31)
at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:323)
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:106)
... 30 common frames omitted
Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "sonar"
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:451)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:223)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:211)
at org.postgresql.Driver.makeConnection(Driver.java:407)
at org.postgresql.Driver.connect(Driver.java:275)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
... 35 common frames omitted
sonar.log:
2019.08.29 17:28:37 INFO app[][o.s.a.SchedulerImpl] Process [web] is stopped
2019.08.29 17:28:37 INFO app[][o.s.a.SchedulerImpl] Process [es] is stopped
2019.08.29 17:28:37 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
2019.08.29 17:28:40 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.08.29 17:28:40 INFO app[][o.s.a.p.JavaProcessLauncherImpl] Launch process[es]: /usr/java/jdk1.8.0_131/jre/bin/java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djna.nosys=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/sonarqube/temp -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /opt/sonarqube/temp/sq-process6725369398987844378properties
2019.08.29 17:28:45 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
2019.08.29 17:28:45 INFO app[][o.s.a.p.JavaProcessLauncherImpl] Launch process[web]: /usr/java/jdk1.8.0_131/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/sonarqube/temp -cp ./lib/common/*:./lib/server/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-9.4.1209.jre7.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process3428525909039640490properties
systemctl status httpd:
[oksmart#CLOUDSVRSONAR01 logs]$ systemctl status httpd -l
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2019-08-29 16:59:00 CEST; 33min ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 5697 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Main PID: 5834 (httpd)
Status: "Total requests: 50; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─5834 /usr/sbin/httpd -DFOREGROUND
├─5835 /usr/sbin/httpd -DFOREGROUND
├─5836 /usr/sbin/httpd -DFOREGROUND
├─5837 /usr/sbin/httpd -DFOREGROUND
├─5839 /usr/sbin/httpd -DFOREGROUND
├─5900 /usr/sbin/httpd -DFOREGROUND
├─5901 /usr/sbin/httpd -DFOREGROUND
├─5903 /usr/sbin/httpd -DFOREGROUND
├─5904 /usr/sbin/httpd -DFOREGROUND
├─5905 /usr/sbin/httpd -DFOREGROUND
└─5906 /usr/sbin/httpd -DFOREGROUND
Aug 29 16:59:00 CLOUDSVRSONAR01 systemd[1]: Starting The Apache HTTP Server...
Aug 29 16:59:00 CLOUDSVRSONAR01 httpd[5834]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::250:56ff:fe01:114a. Set the 'ServerName' directive globally to suppress this message
Aug 29 16:59:00 CLOUDSVRSONAR01 systemd[1]: Started The Apache HTTP Server.
/etc/httpd/conf.d/sonar.oksmart.es.conf :
<VirtualHost *:80>
ServerName localhost
# ProxyPreserveHost On
# ProxyPass / http://localhost:9000/
# ProxyPassReverse / http://localhost:9000/
TransferLog /var/log/httpd/sonar.oksmart.es_access.log
ErrorLog /var/log/httpd/sonar.oksmart.es_error.log
</VirtualHost>
NOTE: I commented the proxy options because if i comment out those lines, i get an error on the web page.
sonar.sh :
DEF_APP_NAME="SonarQube"
DEF_APP_LONG_NAME="SonarQube"
APP_NAME="${DEF_APP_NAME}"
APP_LONG_NAME="${DEF_APP_LONG_NAME}"
WRAPPER_CMD="./wrapper"
WRAPPER_CONF="../../conf/wrapper.conf"
PRIORITY=
PIDDIR="."
RUN_AS_USER=root
...
sonar.service:
[Unit]
Description=SonarQube service
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop
User=root
Group=sonar
Restart=always
[Install]
WantedBy=multi-user.target
Any idea of what am i doing wrong??
Firewall is disabled.
Thanks all!
Looks like the web container failed to startup because of database authentication.
Besides that, you commented out your proxy config, that's why you're seeing default Apache homepage.

NoSuchWindowError: Browsing context has been discarded with GeckoDriver Firefox and Protractor(Selenium)

I'm trying to run a simple test script using protractor.
Environment:
Node Version: v9.8.0
Protractor Version: 5.4.1
Angular Version: 1.x
Browser(s): Mozilla Firefox 60.1.0
Operating System and Version: HELiOS release 6.10
Here's my protractor config file.
exports.config = {
specs: ['todo-spec.js'],
capabilities: {
browserName: 'firefox',
marionette : true
}
};
This is my test script (todo-spec.js)
describe('application homepage', function() {
it('should open homepage', function() {
console.log("Opening localhost app");
browser.get('http://localhost:8080/app/');
browser.sleep(20000); // just to check if application loaded or not
});
});
This is my node_modules/protractor/node_modules/webdriver-manager/selenium/ directory looks like:
When I run my test using /path/to/protractor conf.js, I'm getting below mentioned error.
[16:51:03] I/launcher - Running 1 instances of WebDriver
[16:51:03] I/local - Starting selenium standalone server...
[16:51:04] I/local - Selenium standalone server started at http://<ip-address>:45089/wd/hub
Started
Opening localhost
F
Failures:
1) application homepage should open homepage
Message:
Failed: Browsing context has been discarded
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'HOSTNAME', ip: 'ip_address', os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-754.3.5.el6.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: unknown
Stack:
NoSuchWindowError: Browsing context has been discarded
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'HOSTNAME', ip: 'ip_address', os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-754.3.5.el6.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
From: Task: Protractor.get(http://localhost:8080/app/) - reset url
at thenableWebDriverProxy.schedule (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
at ProtractorBrowser.executeScriptWithDescription (/export/home/test/protractor_test_2/node_modules/protractor/built/browser.js:404:28)
at driver.controlFlow.execute.then.then.then (/export/home/test/protractor_test_2/node_modules/protractor/built/browser.js:679:25)
at ManagedPromise.invokeCallback_ (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:1376:14)
at TaskQueue.execute_ (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:3084:14)
at TaskQueue.executeNext_ (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:3067:27)
at asyncRun (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:2927:27)
at /export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:668:7
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
From: Task: Run it("should open homepage") in control flow
at UserContext.<anonymous> (/export/home/test/protractor_test_2/node_modules/jasminewd2/index.js:94:19)
From asynchronous test:
Error
at Suite.<anonymous> (/export/home/test/protractor_test_2/todo-spec.js:2:3)
at Object.<anonymous> (/export/home/test/protractor_test_2/todo-spec.js:1:63)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
1 spec, 1 failure
Finished in 0.159 seconds
[16:51:06] I/local - Shutting down selenium standalone server.
[16:51:06] I/launcher - 0 instance(s) of WebDriver still running
[16:51:06] I/launcher - firefox #01 failed 1 test(s)
[16:51:06] I/launcher - overall: 1 failed spec(s)
[16:51:06] E/launcher - Process exited with error code 1
Any help would be appreciated.
This error message...
Failed: Browsing context has been discarded
...implies that the communication between GeckoDriver and Marionette was broken.
Some more information regarding the GeckoDriver binary version would have given us some clues about whats wrong happening. However this issue can happen due to multiple factors as follows:
As per Hang when navigation request removes the current browsing context if you have used driver.navigate().back(); when Selenium's focus was within an <iframe> this error is observed.
As per Crash during command execution results in "Internal Server Error: Failed to decode response from marionette" this issue can also occur due to ctypes checks for NULL pointer derefs.
You can find the Selenium testcase here. Perhaps instead of panicking, it would have been better to handle this more gracefully by clearing any state and returning geckodriver to accept new connections again.
As per Failed to decode response from marionette - Error to open Webdriver using python this issue can also occur if you are not using the complient version of the binaries.
This usecase
The root cause of this issue seems to be MemoryUsage. As per Intermittent awsy\test_memory_usage.py TestMemoryUsage.test_open_tabs | NoSuchWindowException: Browsing context has been discarded which is intermittent in nature. This issue was once marked as RESOLVED then again REOPENED.
As #Madhan mentioned while working with AngularJS applications and Protractor always include:
waitForAngularEnabled(true);
Finally, as per best practices while working with GeckoDriver, Selenium and Firefox Browser follow the below compatibility chart:
Supported platforms
Was able to fix this issue with below configuration.
- Protractor: v5.4.1
- Selenium JAR driver: selenium-server-standalone-3.141.59.jar
- geckodriver:geckodriver-v0.20.0-linux64
Also we need to give path of geckodrvier in protractor conf file.
geckoDriver: 'node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.20.0'
By default webdriver-manager will download latest version of geckodriver which is 0.24.0. But the needed geckdriver is v0.20.0, so I downloaded this manually and placed it inside node_modules/protractor/node_modules/webdriver-manager/selenium/ directory.
Hope this helps to people facing similar issue.

Can I use Container Registry trigger for GAE flexible Node.js deploy?

I learned how to use Container Registry trigger for Google Cloud Functions deploy from the following tutorial.
Automatic serverless deployments with Cloud Source Repositories and Container Builder
I have Google App engine flexible app. The runtime is Node.js. I want to deploy the app triggered by git push. Are there any good references?
I'm using these example code. Manual deployment works normally.
* tree
.
├── app.js
├── app.yaml
└── package.json
* app.js
'use strict';
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.status(200).send('Hello, world!').end();
});
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
console.log(`App listening on port ${PORT}`);
console.log('Press Ctrl+C to quit.');
});
* app.yaml
runtime: nodejs
env: flex
* package.json
{
"name": "appengine-hello-world",
"description": "Simple Hello World Node.js sample for Google App Engine Flexible Environment.",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
"author": "Google Inc.",
"repository": {
"type": "git",
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
"node": ">=4.3.2"
},
"scripts": {
"deploy": "gcloud app deploy",
"start": "node app.js",
"lint": "samples lint",
"pretest": "npm run lint",
"system-test": "samples test app",
"test": "npm run system-test",
"e2e-test": "samples test deploy"
},
"dependencies": {
"express": "4.15.4"
},
"devDependencies": {
"#google-cloud/nodejs-repo-tools": "1.4.17"
},
"cloud-repo-tools": {
"test": {
"app": {
"msg": "Hello, world!"
}
},
"requiresKeyFile": true,
"requiresProjectId": true
}
}
* deploy command
$ gcloud app deploy
Update 1
I found a similar question.
How to auto deploy google app engine flexible using Container Registry with Build Trigger
I added cloudbuild.yaml.
steps:
# Build the Docker image.
- name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gcr.io/$PROJECT_ID/app', '.']
# Push it to GCR.
- name: gcr.io/cloud-builders/docker
args: ['push', 'gcr.io/$PROJECT_ID/app']
# Deploy your Flex app from the image in GCR.
- name: gcr.io/cloud-builders/gcloud
args: ['app', 'deploy', 'app.yaml', '--image-url=gcr.io/$PROJECT_ID/app']
# Note that this build pushes this image.
images: ['gcr.io/$PROJECT_ID/app']
However, I got an error. The error message is "error loading template: yaml: line 5: did not find expected key". I'm looking into it.
Update 2
The reason was invalid yaml format. I changed it like the following.
steps:
# Build the Docker image.
- name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gcr.io/$PROJECT_ID/app', '.']
# Push it to GCR.
- name: gcr.io/cloud-builders/docker
args: ['push', 'gcr.io/$PROJECT_ID/app']
# Deploy your Flex app from the image in GCR.
- name: gcr.io/cloud-builders/gcloud
args: ['app', 'deploy', 'app.yaml', '--image-url=gcr.io/$PROJECT_ID/app']
# Note that this build pushes this image.
images: ['gcr.io/$PROJECT_ID/app']
I got another error. The message is "error loading template: unknown field "images" in cloudbuild_go_proto.BuildStep"
Update 3
I noticed that "images" indent was wrong.
steps:
...
# Note that this build pushes this image.
images: ['gcr.io/$PROJECT_ID/app']
I encountered new error.
starting build "e3e00749-9c70-4ac7-a322-d096625b695a"
FETCHSOURCE
Initialized empty Git repository in /workspace/.git/
From https://source.developers.google.com/p/xxxx/r/bitbucket-zono-api-btc
* branch 0da6c8bf209c72b6406f3801f3eb66d346187f4e -> FETCH_HEAD
HEAD is now at 0da6c8b fix invalid yaml
BUILD
Starting Step #0
Step #0: Already have image (with digest): gcr.io/cloud-builders/docker
Step #0: unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /workspace/Dockerfile: no such file or directory
Finished Step #0
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: exit status 1
Yes. I don't have Dockerfile because I use Google App Engine flexible Environment Node.js runtime. It is not necessary Docker.
Update 4
I added Dockerfile
FROM gcr.io/google-appengine/nodejs
Then new error was occurred.
Step #2: ERROR: (gcloud.app.deploy) User [xxxxxxx#cloudbuild.gserviceaccount.com] does not have permission to access app [xxxx] (or it may not exist): App Engine Admin API has not been used in project xxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/appengine.googleapis.com/overview?project=xxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
Update 5
I enabled App Engine Admin API then next error has come.
Step #2: Do you want to continue (Y/n)?
Step #2: WARNING: Unable to verify that the Appengine Flexible API is enabled for project [xxx]. You may not have permission to list enabled services on this project. If it is not enabled, this may cause problems in running your deployment. Please ask the project owner to ensure that the Appengine Flexible API has been enabled and that this account has permission to list enabled APIs.
Step #2: Beginning deployment of service [default]...
Step #2: WARNING: Deployment of service [default] will ignore the skip_files field in the configuration file, because the image has already been built.
Step #2: Updating service [default] (this may take several minutes)...
Step #2: ...............................................................................................................................failed.
Step #2: ERROR: (gcloud.app.deploy) Error Response: [9]
Step #2: Application startup error:
Step #2: npm ERR! path /app/package.json
Step #2: npm ERR! code ENOENT
Step #2: npm ERR! errno -2
Step #2: npm ERR! syscall open
Step #2: npm ERR! enoent ENOENT: no such file or directory, open '/app/package.json'
Step #2: npm ERR! enoent This is related to npm not being able to find a file.
I changed my code tree but it did not work. I confirmed that Appengine Flexible API has been enabled. I have no idea what should I try next.
.
├── Dockerfile
├── app
│   ├── app.js
│   └── package.json
├── app.yaml
└── cloudbuild.yaml
Update 6
When I deploy manually, the artifact is like the following.
us.gcr.io/xxxxx/appengine/default.20180316t000144
Should I use this artifact...? I'm confused..
Update 7
Two builds are executed. I don't know whether this is correct.
Your Dockerfile doesn't copy source to the image.
You can move everything back to the same directory such that
.
├── app.js
├── app.yaml
├── cloudbuild.yaml
├── Dockerfile
└── package.json
but it doesn't matter.
Paste this into your Dockerfile and it should work:
FROM gcr.io/google-appengine/nodejs
# Working directory is where files are stored, npm is installed, and the application is launched
WORKDIR /app
# Copy application to the /app directory.
# Add only the package.json before running 'npm install' so 'npm install' is not run if there are only code changes, no package changes
COPY package.json /app/package.json
RUN npm install
COPY . /app
# Expose port so when container is launched you can curl/see it.
EXPOSE 8080
# The command to execute when Docker image launches.
CMD ["npm", "start"]
Edit: This is the cloudbuild.yaml I used:
steps:
- name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gcr.io/$PROJECT_ID/app', '.']
- name: gcr.io/cloud-builders/docker
args: ['push', 'gcr.io/$PROJECT_ID/app']
- name: gcr.io/cloud-builders/gcloud
args: ['app', 'deploy', 'app.yaml', '--image-url=gcr.io/$PROJECT_ID/app']
images: ['gcr.io/$PROJECT_ID/app']
A tech guy helped me. I changed directory structure and cloudbuild.yaml. Then it worked. Thanks.
* Code Tree
.
├── app
│   ├── app.js
│   ├── app.yaml
│   └── package.json
└── cloudbuild.yaml
* cloudbuild.yaml
steps:
- name: gcr.io/cloud-builders/npm
args: ['install', 'app']
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', 'app/app.yaml']

Resources