pulumi up fails with error: unable to open bucket file

23 Views Asked by At

Running pulumi up fails with:


error: unable to open bucket file:///var/folders/mz/path_to_dir: stat /var/folders/mz/path_to_dir: no such file or directory

error: unable to open bucket file:///var/folders/mz/path_to_another_dir: stat /var/folders/mz/path_to_another_dir: no such file or directory

Checking the file system shows that /var/folders/mz/path_to_dir and /var/folders/mz/path_to_another_dir exist and have the correct owner and permissions setup.

1

There are 1 best solutions below

0
zooblin On BEST ANSWER

It turned out that the issue was with a corrupted ~/.pulumi/credentials.json file.

Valid credentials.json file has the following structure:

{
    "current": "https://api.pulumi.com",
    "accessTokens": {
        "https://api.pulumi.com": "YOUR_TOKEN"
    },
    "accounts": {
        "https://api.pulumi.com": {
            "accessToken": "YOUR_TOKEN",
            "username": "YOUR_USERNAME",
            "organizations": [
                "YOUR_ORG"
            ],
            "lastValidatedAt": "SOME_DATE"
        }
    }
}

In my case the file content was:

{
    "current": "https://api.pulumi.com",
    "accessTokens": {
        "file:///var/folders/mz/path_to_dir": "file:///var/folders/mz/path_to_dir",
        "file:///var/folders/mz/path_to_another_dir": "file:///var/folders/mz/path_to_another_dir"
    },
    "accounts": {
        "https://api.pulumi.com": {
            "accessToken": "YOUR_TOKEN",
            "username": "YOUR_USERNAME",
            "organizations": [
                "YOUR_ORG"
            ],
            "lastValidatedAt": "SOME_DATE"
        }
    }
}

Fixing the credentials.json file to its expected structure fixed the issue.