itsmejoeeey / docker-decap-cms-standalone

Easy-to-use Docker image to self-host Decap CMS (formerly Netlify CMS).
21 stars 8 forks source link

can't find any valid value for ORIGINS #4

Open krodelabestiole opened 7 months ago

krodelabestiole commented 7 months ago

hello, i'm trying to use decap with a local backend using docker compose and traefik. (i'm not sure yet if feasible...)

unfortunately no matter what value I try for ORIGINS env var I run into this issue :

unko-admin  | /app/netlify-cms-github-oauth-provider/login_script.js:5
unko-admin  |   throw new Error('process.env.ORIGIN MUST be comma separated list \

Here is the concerned part of my docker-compose.yml :

  unko-admin:
    image: itsmejoeeey/docker-decap-cms-standalone:latest
    container_name: unko-admin
    environment:
      - ORIGINS=...
    labels:
      - "traefik.http.routers.unko-admin.rule=Host(`unko-admin.localhost`)"

Here are the different values I have tried (trying also different pseudo domains with the traefik label - that wouldn't make any difference yet) :

- ORIGINS=localhost
- ORIGINS=unko-admin
- ORIGINS='unko-admin'
- ORIGINS='unko-admin.localhost,*'
- ORIGINS='unko-admin.localhost,*.localhost'

and many others and since I found this line in your Dockerfile ENV ORIGINS=http://localhost I also tried things like:

- ORIGINS='http://localhost'
- ORIGINS='http://unko.localhost/,http://*/'

no success yet !

itsmejoeeey commented 7 months ago

In my own docker-compose the following works for me:

    cms:
        # headless decap cms service on port 80
        image: itsmejoeeey/docker-decap-cms-standalone:3.0.3
        restart: always
        environment:
            - ORIGINS=abc.example.com
        ...

Might need further investigation.

8BitSensei commented 1 month ago

I'm experiencing the same issue, trying to run it with localhost. I'll include the full error:

2024-05-29 16:10:42 Node.js v18.17.1 2024-05-29 16:10:44 /app/netlify-cms-github-oauth-provider/login_script.js:5 2024-05-29 16:10:44 throw new Error('process.env.ORIGIN MUST be comma separated list \ 2024-05-29 16:10:44 ^ 2024-05-29 16:10:44 2024-05-29 16:10:44 Error: process.env.ORIGIN MUST be comma separated list of origins that login can succeed on. 2024-05-29 16:10:44 at Object. (/app/netlify-cms-github-oauth-provider/login_script.js:5:9) 2024-05-29 16:10:44 at Module._compile (node:internal/modules/cjs/loader:1256:14) 2024-05-29 16:10:44 at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) 2024-05-29 16:10:44 at Module.load (node:internal/modules/cjs/loader:1119:32) 2024-05-29 16:10:44 at Module._load (node:internal/modules/cjs/loader:960:12) 2024-05-29 16:10:44 at Module.require (node:internal/modules/cjs/loader:1143:19) 2024-05-29 16:10:44 at require (node:internal/modules/cjs/helpers:121:18) 2024-05-29 16:10:44 at Object. (/app/netlify-cms-github-oauth-provider/callback.js:1:24) 2024-05-29 16:10:44 at Module._compile (node:internal/modules/cjs/loader:1256:14) 2024-05-29 16:10:44 at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)

8BitSensei commented 1 month ago

I think I see your problem(s), first of all you can find the RegEx that parses ORIGINS here. There are two issues:

  1. In your docker run example in the README.md you have the line -e ORIGINS='<your root url>', this should be -e ORIGINS=<your root url> without the single quotes, these cause the above RegEx to fail.
  2. If a user doesn't provide there own ORIGINS env var we get the default set in your Dockerfile ENV ORIGINS=http://localhost, this also doesn't pass the RegEx.

You can play around with the RegEx here to see for yourself, I'd just remove the single quotes in your example command and amend the Dockerfile to something like ENV ORIGINS=localhost.com.

You can see why @krodelabestiole's attempts all failed but yours is fine, none of them have a domain, and no quotes, and no protocol.