ERROR: Failed to prepare download of the sensor cache

  • ALM used Bitbucket
  • CI system used Bitbucket Cloud
  • Languages of the repository js/ts

output

19:20:47.619 DEBUG: GET 403 https://ea6ne4j2sb.execute-api.eu-central-1.amazonaws.com/current/v1/sensor_cache/prepare_read?organization=XXX&project=YYY&branch=master | time=388ms
19:20:47.622 ERROR: Failed to prepare download of the sensor cache
org.sonar.api.utils.MessageException: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator

sonar-project.properties

sonar.exclusions=node_modules/**/*, reports/**/*
sonar.sources=lib
sonar.language=js
sonar.sourceEncoding=UTF-8
sonar.organization=XXX
sonar.projectKey=YYY
sonar.host.url=https://sonarcloud.io
  • Steps to reproduce
    Followed the walkthrough found here:
    SonarCloud

  • Potential workaround
    Theres pretty much the exact same issue here:
    403 error sensor cache
    Which says that this issue is fixed, so not sure if this is the same?!?

Hey there.

How is your Bitbucket Pipeline configured? Feel free to share the YAML here.

image: node:lts # Choose an image matching your project needs
clone:
  depth: full              # SonarCloud scanner needs the full history to assign issues properly
definitions:
  caches:
    sonar: ~/.sonar/cache  # Caching SonarCloud artifacts will speed up your build
  services:
    docker:
      memory: 2048         # increase memory available to Docker to speed up builds
  steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        caches:
          - node
          - sonar
        script:
          - npm install -g typescript
          - npm install
          - npm run build           # Build your project and run
          - pipe: sonarsource/sonarcloud-scan:1.4.0
            variables:
              DEBUG: 'true'
              SONAR_TOKEN: ${SONAR_TOKEN}
    - step: &check-quality-gate-sonarcloud
        name: Check the Quality Gate on SonarCloud
        script:
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.6
            variables:
              DEBUG: 'true'
              SONAR_TOKEN: ${SONAR_TOKEN}
pipelines:                 # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
  branches:
    master:
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud
  pull-requests:
    ‘**’:
      - step: *build-test-sonarcloud
      - step: *check-quality-gate-sonarcloud

Thanks.

Is this token being stored as a repository/account variable? If so, you shouldn’t need to include this in your YAML – and I wonder if it will make a difference. What happens if you remove this from your YAML?