Question

Updating App Spec via doctl vs. Control Panel - ERROR PARSING

I am trying to provide the app-spec for each deployment via the doctl apps update <app-id> --spec app-production.yml command.

This way I was trying to solve following behaviour:

  • We manually set the cors settings in the app.yml and upload it in the control panel
  • We change the Environment variables via the control panels directly
  • The cors settings are lost and the app.yml seems to be “resetted”

By providing the app.yml during the CI pipeline I was trying to avoid inconsistencies or unexpected behaviour.

However, when I download the spec from the control panel (the exact same spec that is working and deployed) and try to provide it via the doctl apps update command it fails with:

Error: parsing app spec: json: unknown field "allow_headers"

The spec looks roughly like this:

databases:
- engine: PG
  name: db
  num_nodes: 1
  size: db-s-dev-database
  version: "12"
domains:
- domain: XXX
  type: PRIMARY
  zone: XXX 
name: core
region: fra
services:
- cors:
    allow_headers:
    - '*'
    allow_methods:
    - GET
    - OPTIONS
    - POST
    - PUT
    - PATCH
    - DELETE
    allow_origins:
    - exact: YXZ
  envs:
  - key: DATABASE_URL
    scope: RUN_TIME
    value: ${db.DATABASE_URL}
  - key: DB_HOST
    scope: RUN_AND_BUILD_TIME
    value: XXX
  - key: DB_PORT
    scope: RUN_AND_BUILD_TIME
    value: "25060"
  - key: DB_USER
    scope: RUN_AND_BUILD_TIME
    value: db
  - key: DB_PASSWORD
    scope: RUN_AND_BUILD_TIME
    value: XXX
  - key: DB_DATABASE
    scope: RUN_AND_BUILD_TIME
    value: db
  - key: DB_SSL
    scope: RUN_AND_BUILD_TIME
    value: "yes"
  - key: SENDING_MAIL
    scope: RUN_AND_BUILD_TIME
    value: XXX
  - key: RECEIVING_MAIL
    scope: RUN_AND_BUILD_TIME
    value: XXX
  - key: SECRET
    scope: RUN_AND_BUILD_TIME
    value: XXX
  http_port: 80
  image:
    registry_type: DOCR
    repository: core
    tag: latest
  instance_count: 1
  instance_size_slug: basic-xs
  name: core
  routes:
  - path: /
  run_command: bash -c "uvicorn api:app --host 0.0.0.0 --port 80"

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hi @WazzMaxx,

What version of doctl are you using? Support for the new CORS policy fields was only added in the most recent release, v1.61.0.

 $ doctl version
doctl version 1.61.0-release
Git commit hash: c46d9619

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Naturally, I am wondering: How can it be that a spec that I am using in the control panel (and that is obviously working) does not pass the parsing stage of the command line? Thanks in advance for your efforts, suggestions and answers :)