bitbucket-pipeline.yml error: Expected a string but found a mapping

Issue #15610 open
created an issue

The following is valid, but throws an error in the editor and when running a pipeline:

    - step:
          - curl -X POST -u $BB_CREDENTIALS -H "Content-Type: application/json" -d "{\"name\":\"$BITBUCKET_BUILD_NUMBER\",\"target\":{\"hash\":\"$BITBUCKET_COMMIT\"}}"$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/refs/tags

The string "Content-Type: application/json" gives the error:

Expected a string but found a mapping.

Screen Shot 2018-02-01 at 2.45.14 PM.png

The work-around is to put "Content-type: application/json" in an environment variable:

    - step:
          - curl -X POST -u $BB_CREDENTIALS -H "$CONTENT_TYPE" -d "{\"name\":\"$BITBUCKET_BUILD_NUMBER\",\"target\":{\"hash\":\"$BITBUCKET_COMMIT\"}}"$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/refs/tags

Comments (6)

  1. Aneita Yang staff

    Hey Ryan,

    Thanks for raising this. I'll open this bug so that we can keep track of it. The team, however, are currently working on higher priority features so it is unlikely that we'll fix this anytime soon.


  2. Andrew Katsivas

    Found the same thing - in my situation it was the space causing the problem ("X-Octopus-ApiKey: API-APIKEY"). When the space is removed, the problem goes away. This occurs even when trying to bind that same string to a variable and inject it in:

    - export CREDENTIALS="X-Octopus-ApiKey: API-APIKEY"

    This actually changes the syntax highlighting in VSCode when set to YAML as well, so I suspect it's something to do with YAML and not necessarily pipelines.

  3. Log in to comment