From e9bbac1f5b96e83f65e8ca9d56c35196441395e6 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Wed, 6 Nov 2024 16:52:50 +0800 Subject: [PATCH] fix(functions): create new reader for retrying deploy --- pkg/function/batch.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/function/batch.go b/pkg/function/batch.go index 1d52bace4..43f837fc4 100644 --- a/pkg/function/batch.go +++ b/pkg/function/batch.go @@ -55,7 +55,7 @@ func (s *EdgeRuntimeAPI) UpsertFunctions(ctx context.Context, functionConfig con VerifyJwt: function.VerifyJWT, ImportMapPath: toFileURL(function.ImportMap), EntrypointPath: toFileURL(function.Entrypoint), - }, eszipContentType, &body); err != nil { + }, eszipContentType, bytes.NewReader(body.Bytes())); err != nil { return errors.Errorf("failed to update function: %w", err) } else if resp.JSON200 == nil { return errors.Errorf("unexpected status %d: %s", resp.StatusCode(), string(resp.Body)) @@ -67,7 +67,7 @@ func (s *EdgeRuntimeAPI) UpsertFunctions(ctx context.Context, functionConfig con VerifyJwt: function.VerifyJWT, ImportMapPath: toFileURL(function.ImportMap), EntrypointPath: toFileURL(function.Entrypoint), - }, eszipContentType, &body); err != nil { + }, eszipContentType, bytes.NewReader(body.Bytes())); err != nil { return errors.Errorf("failed to create function: %w", err) } else if resp.JSON201 == nil { return errors.Errorf("unexpected status %d: %s", resp.StatusCode(), string(resp.Body))