nextcloud / app_api

Nextcloud AppAPI
https://apps.nextcloud.com/apps/app_api
GNU Affero General Public License v3.0
71 stars 6 forks source link

401 Unauthorized on Test Deploy #291

Closed jannis3005 closed 1 month ago

jannis3005 commented 4 months ago

Describe the bug

While trying to freshly setup AppApi im Stuck on the Test-Deploy. The Container can't reach nextcloud because of a 401 Unauthorized Error:

[401] Unauthorized <request: PUT /ocs/v1.php/apps/app_api/apps/status/test-deploy>

Steps/Code to Reproduce

  1. Install AppApi
  2. Setup Docker Socket Proxy
  3. Configure Daemon
  4. Test Deploy
  5. Wait for Container to Start
  6. Check Container Logs

Expected Results

PUT /ocs/v1.php/apps/app_api/apps/status/test-deploy should not fail

Actual Results

PUT /ocs/v1.php/apps/app_api/apps/status/test-deploy fails with 401 Unauthoriued

Setup configuration

app_api=2.6.0, nextcloud=29.0.0 using nextcloud-appapi-dsp

andrey18106 commented 2 months ago

I can't reproduce this locally on my side, could you please elaborate on your Deploy daemon configuration?

jannis3005 commented 2 months ago

Im running nextcloud together with the dsp inside a docker-compose file within the same network (called nextcloud).

    build: .
    container_name: nextcloud
    restart: unless-stopped
    environment:
      - PHP_MEMORY_LIMIT=8G
    ports:
      - 8084:80
    volumes:
      - ./data:/var/www/html
      - ./logs:/logs
    networks:
      - postgres
      - apache
      - nextcloud
    image: ghcr.io/cloud-py-api/nextcloud-appapi-dsp:release
    container_name: nextcloud-appapi-dsp
    restart: unless-stopped
    privileged: true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - NC_HAPROXY_PASSWORD="<some_password>"
    networks:
      - nextcloud

In the settings, I've set it up using the Docker Socker Proxy Template, with the nextcloud URL being http://nextcloud or http://nextcloud:80, the network set to nextcloud and the password from my compose file.

if there's something more I can provide, I'd be happy to do so :)

suitcaseTrousers commented 1 month ago

Hey, I have a very similar setup and the exact same issue! Have you been able to fix it by any chance?

bigcat88 commented 1 month ago

Andrey told me that it can be reproducible locally after some tries. I will take a look at this tomorrow to include a fix in upcoming AppAPI 3.0

suitcaseTrousers commented 1 month ago

Thanks a lot! If I can provide any further info to help you, please let me know :)

bigcat88 commented 1 month ago

I found the root of the problem and it's huge and has to do with how the APCu cache works.

It's great that we found this, I've already asked colleagues how we can fix this and I'm waiting for their advice.

andrey18106 commented 1 month ago

@jannis3005 @suitcaseTrousers Hi! Please, confirm if it works now with AppAPI 3.0.0 version.

jannis3005 commented 1 month ago

@andrey18106 can confirm it works now, test deploy was successful and managed to also install context chat backend without any problems :+1: thanks a lot :)

suitcaseTrousers commented 1 month ago

@andrey18106 Sorry for the late reply! It works now for me too. Thank you! :)