Getting 403 when deleting environment via API
*Describe your question in as much detail as possible:
- What are you seeing, and how does it differ from what you expect to see?*
-
- I’m getting 403 when deleting the environment via API. I have tried a few ways to pass to the token. Also different tokens - job token and personal token with all privileges - api, sudo, admin, etc. Also, I added the project to
Limit access to this project
in CI/CD settings.
- I’m getting 403 when deleting the environment via API. I have tried a few ways to pass to the token. Also different tokens - job token and personal token with all privileges - api, sudo, admin, etc. Also, I added the project to
curl -X DELETE -H "PRIVATE-TOKEN: [MASKED]" 'https://XXXX.net/api/v4/projects/YYYY%2Fecom2-shop/environments/9813'
{"message":"403 Forbidden"}
curl -X DELETE -F private_token="[MASKED]" 'https://XXXX.net/api/v4/projects/YYYY%2Fecom2-shop/environments/9813'
{"message":"403 Forbidden"}
curl -X DELETE -H "Authorization: Bearer [MASKED]" 'https://XXXX.net/api/v4/projects/YYYY%2Fecom2-shop/environments/9813'
{"message":"403 Forbidden"}
curl -X DELETE 'https://XXXX.net/api/v4/projects/YYYY%2Fecom2-shop/environments/9813?job_token=[MASKED]'
{"message":"403 Forbidden"}
- Consider including screenshots, error messages, and/or other helpful visuals
-
- gitlab-workhorse:
{"content_type":"application/json","correlation_id":"blahblahblah","duration_ms":101,"host":"XXXX.net","level":"info","method":"DELETE","msg":"access","proto":"HTTP/1.1","referrer":"","remote_addr":"127.0.0.1:0","remote_ip":"127.0.0.1","route":"^/api/","status":403,"system":"http","time":"2023-10-02T19:29:19+02:00","ttfb_ms":101,"uri":"/api/v4/projects/YYYY%2Fecom2-shop/environments/9813?job_token=[FILTERED]","user_agent":"curl/8.3.0","written_bytes":27}
- What version are you on (Hint:
/help
) ? and are you using self-managed or gitlab.com? -
- 16.3.5
- What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?
-
- I read Environments API | GitLab | GitLab CI/CD job token | GitLab | Delete pipeline via API fails with 403 Forbidden and some posts on StackOverflow…
-
- Also checked access/error log.