homepage icon indicating copy to clipboard operation
homepage copied to clipboard

Portainer Widget HTTPS

Open Samurai1201 opened this issue 2 years ago • 3 comments

Describe the bug Portainer Widget doesnt work as intended, either due to https, or not accepting my env input

Expected behavior Portainer should display as a widget

Additional context

  • Happens with both "latest" image
  • Docker version 20.10.19
  • Deployment method: Docker-compose/portainer stack

Config lines:

- Portainer:
            icon: /icons/portainer.png
            description: Docker verwalten
            href: https:// -IP- :9443
            widget:
              type: portainer
              url: https:// -IP- :9443
              env: 2
              key: - Redacted -

Error message:

Something went wrong.
TypeError: l.filter is not a function

c@http://172.28.110.158:3000/_next/static/chunks/8019.fdf32b58caf74612.js:1:880
5589/y/h<@http://172.28.110.158:3000/_next/static/chunks/4931-ff1596ae4f86f149.js:1:14837
n@http://172.28.110.158:3000/_next/static/chunks/pages/index-30b83ae3c35e861e.js:1:2657
G@http://172.28.110.158:3000/_next/static/chunks/pages/index-30b83ae3c35e861e.js:1:7391
div
li
Z@http://172.28.110.158:3000/_next/static/chunks/pages/index-30b83ae3c35e861e.js:1:8521
ul
C@http://172.28.110.158:3000/_next/static/chunks/pages/index-30b83ae3c35e861e.js:1:11086
div
I@http://172.28.110.158:3000/_next/static/chunks/pages/index-30b83ae3c35e861e.js:1:11373
div
div
K@http://172.28.110.158:3000/_next/static/chunks/pages/index-30b83ae3c35e861e.js:1:19712
n@http://172.28.110.158:3000/_next/static/chunks/pages/index-30b83ae3c35e861e.js:1:2657
6747/G<@http://172.28.110.158:3000/_next/static/chunks/pages/_app-fc77031352f30888.js:1:82737
V@http://172.28.110.158:3000/_next/static/chunks/pages/index-30b83ae3c35e861e.js:1:17771
div
div
Y@http://172.28.110.158:3000/_next/static/chunks/pages/index-30b83ae3c35e861e.js:1:21904
a@http://172.28.110.158:3000/_next/static/chunks/pages/_app-fc77031352f30888.js:1:73304
s@http://172.28.110.158:3000/_next/static/chunks/pages/_app-fc77031352f30888.js:1:73861
u@http://172.28.110.158:3000/_next/static/chunks/pages/_app-fc77031352f30888.js:1:72736
6747/G<@http://172.28.110.158:3000/_next/static/chunks/pages/_app-fc77031352f30888.js:1:82737
6207/t.default<@http://172.28.110.158:3000/_next/static/chunks/pages/_app-fc77031352f30888.js:1:72186
F@http://172.28.110.158:3000/_next/static/chunks/pages/_app-fc77031352f30888.js:1:7870
n@http://172.28.110.158:3000/_next/static/chunks/pages/_app-fc77031352f30888.js:1:67946
r@http://172.28.110.158:3000/_next/static/chunks/main-d2b206db40ae9853.js:1:6949
Y@http://172.28.110.158:3000/_next/static/chunks/main-d2b206db40ae9853.js:1:9188
ie@http://172.28.110.158:3000/_next/static/chunks/main-d2b206db40ae9853.js:1:11828

Samurai1201 avatar Oct 20 '22 17:10 Samurai1201

@Samurai1201 are there any errors in the config/logs/homepage.log file?

JazzFisch avatar Oct 20 '22 18:10 JazzFisch

[2022-10-20T17:08:56.920Z] error: can not read a block mapping entry; a multiline key may not be an implicit key (40:20)

 37 |                 type: portainer
 38 |                 url: https:// -IP- :9443
 39 |                 env: 2
 40 |                 key: -Redacted- ...
-------------------------^

Samurai1201 avatar Oct 20 '22 18:10 Samurai1201

Seems like a helpful error. May I suggest https://duckduckgo.com/?q=error%3A+can+not+read+a+block+mapping+entry%3B+a+multiline+key+may+not+be+an+implicit&ia=web --> https://stackoverflow.com/a/73838504/5331804 --> https://jsonformatter.org/yaml-formatter

shamoon avatar Oct 20 '22 18:10 shamoon

Thanks for the tip with the formatter. Now my code looks way better, but it didnt fix my problem. Turns out the log message was from a previous misconfiguration and not related to this problem Sorry

Samurai1201 avatar Oct 21 '22 06:10 Samurai1201

What are the results of curl -L -H 'X-Api-Key:YOURKEY' 'https://YOURPORTAINERURL/api/endpoints/2/docker/containers/json' ?

shamoon avatar Oct 21 '22 06:10 shamoon

curl: (60) SSL certificate problem: self signed certificate Thats what I already expected, but I dont know how to bypass in hompage

Samurai1201 avatar Oct 21 '22 06:10 Samurai1201

Homepage should handle/ignore the self signed cert just fine. You can try

curl -k -L -H 'X-Api-Key:YOURKEY' 'https://YOURPORTAINERURL/api/endpoints/2/docker/containers/json'

to have curl do the same.

benphelps avatar Oct 21 '22 07:10 benphelps

curl: (3) URL using bad/illegal format or missing URL

Now comes up as an additional error message. It didnt mention this earlier, I am using portainer-ee instead of portainer-ce

Samurai1201 avatar Oct 21 '22 07:10 Samurai1201

curl -L -H -k 'X-Api-Key: - Redacted - ' 'https://192.168.178.77:9443/api/endpoints/2/docker/containers/json' Just to clarify, this is the command I used (with the key being redacted for obvious reasons)

Samurai1201 avatar Oct 21 '22 07:10 Samurai1201

The position of the -k argument matters.

benphelps avatar Oct 21 '22 08:10 benphelps

OP please re-open if theres truly a bug here

shamoon avatar Oct 22 '22 15:10 shamoon

Greetings.

Sorry for re-opening closed ticket, but I might have some insight on the problem. Researching a similar Portainer widget issue I got following reply for curl request:

{"message":"Permission denied to access environment","details":"Access denied to environment"}

I granted new user with admin rights and widget worked, although documentation says nothing regarding privileges, while user actually do require at least Helpdesk level privileges for certain environment, Read-only and Standard user won't cut. Such kind of access seems excessive for API read requests tbh, should it really work this way?

YujiTFD avatar Dec 25 '22 09:12 YujiTFD

Homepage has nothing to do with deciding what user level has api access, that’d be a decision at the portainer project

shamoon avatar Dec 25 '22 15:12 shamoon

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion for related concerns.

github-actions[bot] avatar Feb 06 '24 00:02 github-actions[bot]