Hi <@U078PSKNT2L> - we're having trouble getting s...
# general
j
Hi @lemon-scooter-94063 - we're having trouble getting started - where do we send a support ticket. We've tried running this through claude code a number of times but no success. We've upgraded to teams. Here is the overview: # Pulumi CLI Authentication Issue ## Environment - Pulumi CLI Version: Latest (as of Jan 2025) - OS: macOS Darwin 24.1.0 - Account Type: Team (recently upgraded from trial) - Organization: cogzia-org - Access Token: pul-[REDACTED] ## Issue Cannot authenticate with Pulumi CLI despite having a valid access token that works with the API directly. ## Error Message
Copy code
error: getting user info from https://app.pulumi.com: unmarshalling response object: invalid character '<' looking for beginning of value
## What Works ✅ Token validates successfully via API:
Copy code
bash
curl -H "Authorization: token pul-9d0...948b" \
     https://api.pulumi.com/api/user
# Returns valid JSON with user info
✅ Can list organizations via API:
Copy code
bash
curl -H "Authorization: token pul-9d0...948b" \
     https://api.pulumi.com/api/user | jq '.organizations'
# Shows gregk-org and cogzia-org
## What Fails ❌ Method 1: Direct login with token
Copy code
bash
pulumi login --access-token pul-9d0...948b
_# Initially shows: "Logged in to pulumi.com as gregk"_
_# But then: pulumi whoami_
_# Error: getting user info from https://app.pulumi.com: unmarshalling response object: invalid character '<'_
❌ Method 2: Environment variable
Copy code
bash
export PULUMI_ACCESS_TOKEN="pul-9d0...948b"
pulumi login
_# Same error as above_
❌ Method 3: Interactive login
Copy code
bash
pulumi login
_# Opens browser, completes auth successfully_
_# But subsequent commands fail with same error_
❌ Method 4: Direct stack operations
Copy code
bash
export PULUMI_ACCESS_TOKEN="pul-9d0...948b"
pulumi stack init prod
_# Error: Logging in using access token from PULUMI_ACCESS_TOKEN_
_# error: getting user info from https://app.pulumi.com: unmarshalling response object: invalid character '<'_
## Attempted Mitigations 1. Cleared all state
Copy code
bash
   pulumi logout
   rm -rf ~/.pulumi
   rm -rf .pulumi
Result: No change 2. Tried different API endpoints - CLI uses
https://app.pulumi.com
for user info (fails) - Direct API calls to
https://api.pulumi.com
work fine - Appears to be endpoint mismatch or response format issue 3. Attempted local backend
Copy code
bash
   pulumi login file://~/.pulumi-local
Result: Works, but cannot use organization features 4. Direct API stack creation - Attempted to create stack via REST API - Various endpoints return 404 despite valid token ## Root Cause Analysis The CLI appears to be: 1. Successfully authenticating with the token 2. Then calling
https://app.pulumi.com
for user info (instead of api.pulumi.com) 3. Receiving HTML (likely a redirect or error page) instead of JSON 4. Failing to parse with "invalid character '<'" error ## Business Impact We need Infrastructure as Code for our GCP Cloud Run services. Without working Pulumi CLI: - Cannot manage infrastructure declaratively - Cannot use team collaboration features - Cannot integrate with CI/CD ## Expected Resolution The Pulumi CLI should work with the access token as documented. Specifically: -
pulumi login --access-token <token>
should fully authenticate -
pulumi whoami
should return user info -
pulumi stack init cogzia-org/cogzia-infrastructure/prod
should create stack ## Request Please investigate why the CLI is: 1. Using
app.pulumi.com
instead of
api.pulumi.com
for API calls 2. Receiving HTML responses instead of JSON 3. Unable to complete authentication despite valid token We'd like to get started with pulumi but this is a big blocker to adoption.
e
Few things to check. Do you have the environment variable "PULUMI_BACKEND_URL" set? Does your Pulumi.yaml have a "backend" value set? What URL is in your ~/.pulumi/credentails.json file?
👆 1
👀 1
🙏 1
j
Thanks @echoing-dinner-19531 - that resolved the issue 🙏 tldr; # Pulumi Issue RESOLVED ✅ ## Root Cause The issue was in the
Pulumi.yaml
file having:
Copy code
yaml
backend:
  url: https://app.pulumi.com
This caused the CLI to use the wrong endpoint for API calls. ## Solution 1. Removed the backend section from Pulumi.yaml (let it use defaults) 2. Changed project name 3. Re-authenticated with token ## Working Commands
Copy code
bash
# 1. Logout and clean state
pulumi logout

# 2. Set token and login
export PULUMI_ACCESS_TOKEN="pul-9d0...948b"
pulumi login

# 3. Create stack
pulumi stack init ...

# 4. Configure
..
## Current Status ✅ Authenticated successfully ✅ Stack created ✅ Configuration set ✅ Ready to deploy infrastructure ## View in Console https://app.pulumi.com/cogzia-org/cogzia-infrastructure/prod ## Next Steps 1. Import existing resources:
uv run python pulumi_import.py
2. Preview changes:
pulumi preview
3. Deploy:
pulumi up
## Lesson Learned Don't explicitly set
backend.url
in Pulumi.yaml unless using a custom backend. The default works correctly for Pulumi Cloud Service.