DataDog / datadog-sync-cli

Datadog cli tool to sync resources across organizations.
BSD 3-Clause "New" or "Revised" License
40 stars 11 forks source link

403 Forbidden after 467634b4 #301

Open dhduvall opened 1 week ago

dhduvall commented 1 week ago

I updated this morning and everything stopped working. I got a stream of things like

2024-11-07 10:48:27,849 - WARNING - [users - ] - error while running pre-apply hook: 403 Forbidden - {"errors":["Forbidden"]}
2024-11-07 10:48:28,085 - WARNING - [teams - ] - error while running pre-apply hook: 403 Forbidden - {"errors":["Forbidden"]}

When I backed off to the previous commit, it started working again. I guess my app key doesn't have permission to write metrics?

Putting a try/except around those two lines allowed it to work again.

skarimo commented 5 days ago

Hello, you are correct. Your app key probably does not have permission to push metrics. Could you try disabling emission by setting --send-metrics false?

dhduvall commented 2 days ago

Yes, --send-metrics false works around the problem. I don't understand why the key doesn't have the permissions—it's created by a user with the Datadog Admin Role and has no scopes, and I'd expect that to be able to do everything, including writing metrics, as it's enabled for the role. But I see that the try/except is better done in CustomClient.send_metric()