[Bug]: A failed artifact push on reconnect clears the gateway's record of the control plane's artifact ID
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 83/100
Research direction
Start at gateway/gateway-controller/pkg/controlplane/sync.go:741, where reconnect failures call UpdateCPSyncStatus, and compare with the single-push call at pkg/controlplane/client.go:4730. Check how the stored ID is updated in pkg/storage/sql_store.go:1336. Done when a failed reconnect push preserves the existing control-plane artifact ID; verify with a regression test for that failure path.
Written by the indexing model from the issue text.
Description
Please select the area the issue is related to
Gateway
Please select the aspect the issue is related to
Aspect/Other (Anything else which does not match above categories)
Description
When the gateway reconnects, it re-pushes every artifact it created. If the control plane rejects one of them, the gateway marks it failed and also deletes the control plane's artifact ID it had stored for it. A failed single push (on create or update) keeps the ID; only the reconnect push clears it.
Until a later push succeeds, the gateway can't match control-plane events that name the artifact by its control-plane ID. API keys are one example: getArtifactConfigByID falls back to the stored ID (pkg/utils/api_key.go:1930), and the API-key backfill on connect maps by it (pkg/controlplane/client.go:1126).
Observed
- I created a REST API on the gateway with the project-id annotation of an existing project. It was pushed, and the gateway recorded
cp_artifact_id. - I updated it on the gateway to the annotation of a project that doesn't exist, so the control plane rejects the push.
cp_sync_statusbecamefailed, andcp_artifact_idwas still set. - I restarted gateway-controller. The reconnect push failed for the same reason,
cp_sync_statusisfailed, andcp_artifact_idis now NULL.
Expected
A failed push leaves the stored control-plane artifact ID unchanged, as the single-push path already does.
Cause
The reconnect push records a failure with an empty ID (gateway/gateway-controller/pkg/controlplane/sync.go:741: UpdateCPSyncStatus(cfg.UUID, "", …)), and UpdateCPSyncStatus writes NULL for an empty ID (pkg/storage/sql_store.go:1336). The single-push path passes the existing ID (pkg/controlplane/client.go:4730: UpdateCPSyncStatus(cfg.UUID, cfg.CPArtifactID, …)). The fix is to pass cfg.CPArtifactID at sync.go:741.
Steps to Reproduce
- Create a REST API on a connected gateway with the project-id annotation of an existing project, and wait for it to be pushed.
- Update it on the gateway so the control plane rejects the push (for example, an annotation naming a project that doesn't exist).
- Restart gateway-controller.
- In the gateway's database, the artifact's
cp_artifact_idis now NULL.
Severity Level of the Issue
Severity/Minor (Non-critical functionality. Can be fixed in future releases)
Environment Details (with versions)
Current main (0ee943ff4). Platform-api and gateway built from source and run by the IT suite (tests/framework), with the gateway on SQLite, on macOS with Rancher Desktop.
- Dominant language
- Go
- Stars
- 85
- Forks
- 137
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 247
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from wso2/api-platform
-
Area/DeveloperPortal Aspect/UI Severity/Minor Type/Bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
wso2/api-platform#4369 ·
Maintainers usually reply within 1 day
-
[Bug]: host-rewrite policy documentation lists fewer allowed host characters than the policy acceptsOpenArea/Policies Aspect/Other Severity/Trivial Type/Bug
Difficulty 1/5 Under an hour Newbie friendliness 91/100
wso2/api-platform#4355 ·
Maintainers usually reply within 1 day
-
Area/Gateway Aspect/API Severity/Minor Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
wso2/api-platform#4348 ·
Maintainers usually reply within 1 day
-
Aspect/AI Aspect/API. Severity/Major
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
wso2/api-platform#4343 ·
Maintainers usually reply within 1 day
-
Area/Policies Aspect/Configuration Severity/Minor Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
wso2/api-platform#4330 ·
Maintainers usually reply within 1 day
All issues in wso2/api-platform
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Inconsistency between golang and cue in specPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
security
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Tencent/LoopForge#1087 · 1 comment ·
Maintainers usually reply within 1 day