Unexpected Error: "500"
Expected Behavior
Current Behavior
Possible Solution
Steps to Reproduce (for bugs)
Context
Browser Stack Trace:
at undefined (/static/js/app_4296.js:2)
at f (/static/js/vendors~app_b5c8.js:2)
at T._settlePromiseFromHandler (/static/js/vendors~app_b5c8.js:2)
at T._settlePromise (/static/js/vendors~app_b5c8.js:2)
at T._settlePromise0 (/static/js/vendors~app_b5c8.js:2)
at T._settlePromises (/static/js/vendors~app_b5c8.js:2)
at p (/static/js/vendors~app_b5c8.js:2)
at d (/static/js/vendors~app_b5c8.js:2)
at u._drainQueues (/static/js/vendors~app_b5c8.js:2)
at drainQueues (/static/js/vendors~app_b5c8.js:2)
at MutationObserver.<anonymous> (/static/js/vendors~app_b5c8.js:2)
Your Environment
- Sensu version used (sensuctl, sensu-backend, and/or sensu-agent):
sensu/web revision:
c0890b2 - Installation method (packages, binaries, docker etc.):
- Operating System and version (e.g. Ubuntu 14.04):
I am getting this error, even after using the installation steps given in https://github.com/sensu/web/blob/master/INSTALL.md But I have sensu-backend and sensu-web docker containers. While I am usinf the installation steps to config in Dockerfile for the sensu web. I am using port 3000 for the web-ui but while i enter the credentials it does not let me logged in and gives out above mentioned error. I am using sensu-backend of version 6.1
The 500 likely means it's unable to communicate with the backend. Please provide further context, logs etc, as the stack trace isn't enough to figure out the cause.
I have tried two ways to use sensu/web for making the sensu dashboard accessible. The below are the two scenarios I had tried:
- Sense-backend as a docker container with listening to port 8080 and 8081 and Sensu-web as another container with listening to the port 3000: Sense-backend container config : docker_container 'sensu-backend' do repo 'sensu-backend' tag version detach true action :run command 'sensu-backend start --state-dir /var/lib/sensu/sensu-backend --log-level debug' volumes '/var/lib/sensu:/var/lib/sensu' env [ "SENSU_BACKEND_CLUSTER_ADMIN_USERNAME=#{sensu_user}", "SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD=#{sensu_pass}", ] port ['8080:8080', '8081:8081'] restart_policy 'always' subscribes :redeploy, 'docker_image[sensu-backend]', :immediately log_opts %w(max-size=100m max-file=10) end docker_container 'sensu-web' do repo 'sensu-web' tag version detach true action :run env [ "NODE_ENV=production", "PORT=3000", "API_URL=https://#{sensu_dashboard_ip}:8080", ] port ['3000:3000'] restart_policy 'always' subscribes :redeploy, 'docker_image[sensu-web]', :immediately log_opts %w(max-size=100m max-file=10) end
In this I don’t get any logs to fetch in journalctl of sense-backend container or on sense-web container I see the error message only on the dashboard which not letting me to log in even before authentication it is giving the error of that I have above. In this the steps for installation of yarn and cloning of sensu/web is being done in docker file of sense-web
- Sense-backend is a docker container listening to port 8080,8081 and 3000
docker_container 'sensu-backend' do
repo 'sensu-backend'
tag version
detach true
action :run
command 'sensu-backend start --state-dir /var/lib/sensu/sensu-backend --log-level debug'
volumes '/var/lib/sensu:/var/lib/sensu'
env [
"SENSU_BACKEND_CLUSTER_ADMIN_USERNAME=#{sensu_user}",
"SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD=#{sensu_pass}",
]
port ['8080:8080', '8081:8081’, ‘3000:3000’]
restart_policy 'always'
subscribes :redeploy, 'docker_image[sensu-backend]', :immediately
log_opts %w(max-size=100m max-file=10)
end
In this method, I tried manually installing the yarn and the steps as per : https://github.com/sensu/web/blob/master/INSTALL.md and tried to access the sensu dashboard on http://{sensu_dashboard_ip}:3000
In both scenarios the login page appears but once the credentials are entered it will produce the error with 500.
I get this error on the interactive mode of yarn [HPM] Error occurred while trying to proxy request /auth from sensu-dashboard-ip:3000 to https://sensu-dashboard-ip:8080:8080 (EPROTO) (https://nodejs.org/api/errors.html#errors_common_system_errors)
Also, i opened another session of my sensu-backend container and tried "curl -lv 127.0.0.1:3000", then it gives response 200. as below: The same also works on my workstation/ host machine (where i am trying to check on the browser) terminal, when i provide the sensu-dashboard-ip instead of the loopback ip for the curl query.
/ # curl -Lv 127.0.0.1:3000
- Trying 127.0.0.1:3000...
- Connected to 127.0.0.1 (127.0.0.1) port 3000 (#0)
GET / HTTP/1.1 Host: 127.0.0.1:3000 User-Agent: curl/7.69.1 Accept: /
- Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < X-Powered-By: Express < Accept-Ranges: bytes < Content-Type: text/html; charset=utf-8 < Content-Length: 1299 < ETag: W/"513-2G/7Re56bNSsJ812/XthR3E+K9E" < Vary: Accept-Encoding < Date: Thu, 19 Nov 2020 14:25:37 GMT < Connection: keep-alive <
I'm also running into this error message with Sensu Web release versions v1.0.3 and v1.0.4 on a cluster which I recently upgraded from Sensu Go v5.21 to v6.1.3 (self-compiled sensu-backend binary with Go v1.13 per building from source guide). The sensu-backend and web application are running on CentOS 7 hosts
The web UI (and logging in with default admin credentials) were working prior to the v6 upgrade and Sensu Web deployment following the install guide.
Here's the full error message from the console:
Unhandled rejection t@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:131472
t@https://test-sensu.example.com/static/js/app_8166.js:2:361058
t@https://test-sensu.example.com/static/js/app_8166.js:2:361478
oCqM/</t.a/<@https://test-sensu.example.com/static/js/app_8166.js:2:786587
f@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:536400
i/<[15]</n.exports/T.prototype._settlePromiseFromHandler@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:524717
i/<[15]</n.exports/T.prototype._settlePromise@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:525517
i/<[15]</n.exports/T.prototype._settlePromise0@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:526216
i/<[15]</n.exports/T.prototype._settlePromises@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:527568
p@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:488022
d@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:487962
i/<[1]</u.prototype._drainQueues@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:489482
u/this.drainQueues@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:487703
i/<[18]</a</t<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:533337
MutationCallback*i/<[18]</a<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:533289
i/<[1]</u.prototype._queueTick@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:489641
f@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:487915
i/<[15]</n.exports/T.prototype._fulfill@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:526606
i/<[15]</n.exports/T.prototype._resolveCallback@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:523461
i/<[20]</t.exports/</</c<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:535986
promise callback*f@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:536400
i/<[20]</t.exports/</<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:535960
i/<[20]</t.exports/<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:536128
i/<[15]</n.exports/T.cast@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:519659
oCqM/</t.a@https://test-sensu.example.com/static/js/app_8166.js:2:786482
eiHe/d<@https://test-sensu.example.com/static/js/app_8166.js:2:749733
a/<@https://test-sensu.example.com/static/js/app_8166.js:2:762580
createTokens@https://test-sensu.example.com/static/js/app_8166.js:2:752371
dMq0/</O</t.prototype.resolveField/</<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:605290
s/</<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:681910
s/<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:682015
l/<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:680952
i/<[7]</n.exports/n.prototype._execute@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:501409
i/<[15]</n.exports/T.prototype._resolveFromExecutor@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:524312
T@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:517386
l@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:680732
dMq0/</O</t.prototype.resolveField@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:604930
f/</<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:604456
s/</<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:681910
s/<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:682015
l/<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:680952
i/<[7]</n.exports/n.prototype._execute@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:501409
i/<[15]</n.exports/T.prototype._resolveFromExecutor@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:524312
T@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:517386
l@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:680732
f@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:604325
dMq0/</O</t.prototype.resolveSelectionSet/</<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:604805
s/</<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:681910
s/<@https://test-sensu.example.com/static/js/vendors~app_60e5.js:2:682015
My whole setup is built from source (backend also) so it might be different but once I've changed from https://127.0.0.1:8080 (which is what is written in the INSTALL.md) to http://127.0.0.1:8080 the UI was able to reach the /auth route and it was working OK.
Here is the command that is now working for me:
NODE_PROXY_SECURE=false NODE_ENV=development PORT=5000 API_URL=http://127.0.0.1:8080 yarn node scripts serve --modules-folder /opt/sensu/yarn/node_modules
@tzachs It sounds like you just don't have HTTPS enabled on your backend API service. You should be able to config your backend.yml config file with api-url: "https://localhost:8080" Then your API_URL sensu web environment variable can go back to API_URL=https://127.0.0.1:8080. You probably won't run into MITM attacks since it's local connections but it always feels better when traffic is encrypted.
Thanks @thisgarryhas2rs for the tip :) I was just trying to help @iampbharadwaj and @toozej-cambia with their error.