pulumi/pulumi · error

creating organization webhook: %w

Error message

creating organization webhook: %w

What it means

After building the CreateOrgWebhook request (filters, name, URL, optional secret), the command calls `cloudBackend.Client().CreateOrgWebhook(ctx, orgName, req)`. Any failure from that API call is wrapped as `creating organization webhook: %w`, keeping the server/transport error visible.

Source

Thrown at pkg/cmd/pulumi/org/org_webhook_new.go:307

		formatPtr = nil
	}

	req := apitype.Webhook{
		OrganizationName: orgName,
		DisplayName:      name,
		PayloadURL:       webhookURL,
		Active:           c.active,
		Format:           formatPtr,
		Groups:           groups,
		Filters:          events,
	}
	if c.secret != "" {
		req.Secret = c.secret
	}

	created, err := cloudBackend.Client().CreateOrgWebhook(ctx, orgName, req)
	if err != nil {
		return fmt.Errorf("creating organization webhook: %w", err)
	}

	return c.output.Get()(c, created)
}

func (c *orgWebhookNewCmd) renderText(wh apitype.Webhook) error {
	fmt.Fprintf(c.w, "Created webhook %q\n", wh.Name)
	return nil
}

func (c *orgWebhookNewCmd) renderJSON(wh apitype.Webhook) error {
	enc := json.NewEncoder(c.w)
	enc.SetEscapeHTML(false)
	enc.SetIndent("", "  ")
	return enc.Encode(toOrgWebhookJSON(wh))
}

// orgFiltersNotCoveredByGroups returns event filters not covered by selected groups.

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Inspect the wrapped cause; for 403, ensure your token/account can manage webhooks for that org (org admin)
  2. Verify --name, --url, and --filters values satisfy the API (URL reachable/https, valid group/event names via --filters)
  3. Re-authenticate with `pulumi login` for 401 causes; retry if cause is 5xx/timeout

Example fix

// before (non-admin token)
pulumi org webhook new --org my-org --name wh --url https://example.com/hook  # 403
// after
pulumi login  # with an org admin account, then retry
pulumi org webhook new --org my-org --name wh --url https://example.com/hook
Defensive patterns

Strategy: retry

Validate before calling

pulumi org list 2>/dev/null | grep -qx "$ORG" || { echo "No admin access to $ORG"; exit 1; }

Type guard

// n/a: server-side authorization; use a pre-flight permissions check instead

Try / catch

for i in 1 2 3; do out=$(pulumi org webhook new ... 2>&1) && break; case "$out" in *'creating organization webhook: '*403*) break;; esac; sleep $((2**i)); done

Prevention

When it happens

Trigger: `pulumi org webhook new` with valid local inputs when the CreateOrgWebhooks API call fails: 401/403 (no org admin rights), 404 (org not found), 400 for invalid payload (e.g. disallowed URL), or network/5xx errors.

Common situations: User is a member but not admin of the org, token without webhook scopes, invalid characters in --name, unreachable or rejected payload URL, transient Pulumi Cloud incidents.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/153ea0298f2f9cc2. Report an issue: GitHub.