Failed to deploy a stack

I get this error:

Failure
failed to deploy a stack: Service "nextcloud" uses an undefined secret file "/opt/docker-mounts/nextcloud/secrets/nc_dbpassword", the following file should be created "/opt/docker-mounts/nextcloud/secrets/nc_dbpassword" Service "nextcloud" uses an undefined secret file "/opt/docker-mounts/nextcloud/secrets/nc_dbname", the following file should be created "/opt/docker-mounts/nextcloud/secrets/nc_dbname" Service "nextcloud" uses an undefined secret "nc_dbsuser" : exit status 1

here is my compose file:

version: "3.7"

secrets:
   nc_dbpassword:
     file: /opt/docker-mounts/nextcloud/secrets/nc_dbpassword
   nc_root-dbpassword:
     file: /opt/docker-mounts/nextcloud/secrets/nc_rootdbpassword
   nc_dbhost:
     file: /opt/docker-mounts/nextcloud/secrets/nc_dbhost
   nc_dbname:
     file: /opt/docker-mounts/nextcloud/secrets/nc_dbname
   nc_dbuser:
     file: /opt/docker-mounts/nextcloud/secrets/nc_dbuser

services:
  nextcloud:
    image: nextcloud:23.0.3-apache
    container_name: nextcloud
    hostname: nextcloud
    restart: unless-stopped
    networks:
      - nc
      - t2_proxy
      - nc-dbnet
    volumes:
      - /opt/docker-mounts/nextcloud/app:/var/www/html
    environment:
      REDIS_HOST: nc-redis
      NEXTCLOUD_TRUSTED_DOMAIN: next.chrisgolden.cz
      TRUSTED_PROXIES: 192.168.1.0/24
      MYSQL_PASSWORD_FILE: /run/secrets/nc_dbpassword
      MYSQL_DATABASE_FILE: /run/secrets/nc_dbname
      MYSQL_USER_FILE: /run/secrets/nc_dbuser
      MYSQL_HOST_FILE: /run/secrets/nc_dbhost
    secrets:
      - nc_dbpassword
      - nc_dbname
      - nc_dbsuser
      - nc_dbhost
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.nc-rtr.entrypoints=https"
      - "traefik.http.routers.nc-rtr.rule=Host(`next.domain.com`)"
      - "traefik.http.routers.nc-rtr.tls=true"
      ## HTTP Services
      - "traefik.http.routers.nc-rtr.service=nc-svc"
      - "traefik.http.services.nc-svc.loadbalancer.server.port=80"
      - "traefik.port=80"
      - "traefik.http.routers.nc-rtr.middlewares=chain-no-auth@file"
      - "traefik.http.routers.nc-rtr.middlewares=chain-authelia@file"  
      - 'traefik.http.routers.nc.middlewares=authelia@docker'

  nc-redis:
    image: redis:6.2.6-alpine
    container_name: nc-redis
    hostname: nc-redis
    restart: unless-stopped
    networks:
      - nc
    volumes:
      - /opt/docker-mounts/nextcloud/redis:/data
      
  db:
    image: nc-mariadb
    restart: always
    container_name: nc-mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    networks:
      - nc-dbnet
    volumes:
      - /opt/docker-mounts/nextcloud/mysql:/var/lib/mysql
    environment:
      - MYSQL_PASSWORD_FILE=/run/secrets/nc_dbpassword
      - MYSQL_DATABASE_FILE=/run/secrets/nc_dbname
      - MYSQL_USER=/run/secrets/nc_dbuser
      - MYSQL_HOST=/run/secrets/nc_dbhost
    secrets:
      - nc_dbpassword
      - nc_dbname
      - nc_dbsuser
      - nc_dbhost
      
networks:
  nc:
    name: nc
    driver: bridge
  t2_proxy:
    name: t2_proxy
  nc-dbnet:
    name: nc-dbnet
    driver: bridge

Any ideas what I have done wrong?

Does anyone have a solution to this?

The obvious: there is an inonsistency between the declared secret nc_dbuser and the used secret in the services, which is nc_dbsuser

How do you deploy your stack? docker stack deploy or docker compose?
Are you sure the files you try exist?