Skip to content

Commit 51f5349

Browse files
fix: add auth header to fly api call (#829)
This commit adds the necessary Authorization header to the Fly API delete machine request to ensure proper authentication. We also increase the reap batch size to 50.
1 parent 0f70699 commit 51f5349

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.changeset/cute-chicken-lead.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"server": patch
3+
---
4+
5+
Added the necessary Authorization header to the Fly API delete machine request
6+
to ensure proper authentication. We also increase the reap batch size to 50.

server/internal/background/activities/reap_functions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (r *ReapFlyApps) Do(ctx context.Context, req ReapFlyAppsRequest) (*ReapFlyA
7474
KeepCount: pgtype.Int8{Int64: r.keepCount, Valid: true},
7575
// Starting with a small batch size for now and we'll increase later on
7676
// after some observation.
77-
BatchSize: pgtype.Int8{Int64: 20, Valid: true},
77+
BatchSize: pgtype.Int8{Int64: 50, Valid: true},
7878
})
7979
if err != nil {
8080
return nil, oops.E(oops.CodeUnexpected, err, "failed to query apps to reap").Log(ctx, logger)

server/internal/functions/deploy_fly.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,11 @@ func (f *FlyRunner) reap(ctx context.Context, logger *slog.Logger, appsRepo *rep
570570
return fmt.Errorf("create delete app request: %w", err)
571571
}
572572

573+
bearer := "Bearer " + f.tokens.GraphQL()
574+
deleteRequest.Header.Set("User-Agent", f.ua)
575+
deleteRequest.Header.Set("Content-Type", "application/json")
576+
deleteRequest.Header.Set("Authorization", bearer)
577+
573578
res, err := f.machinesClient.Do(deleteRequest)
574579
if err != nil {
575580
return fmt.Errorf("send delete app request: %w", err)

0 commit comments

Comments
 (0)