adobe / helix-deploy

A multi-cloud deployment tool for serverless functions running on AWS Lambda, Adobe I/O Runtime, Azure Functions, and Google Cloud Functions. Write once, run everywhere.
Apache License 2.0
11 stars 15 forks source link

[cloudflare] restore cloudflare worker script settings after deploy #707

Closed maxakuru closed 4 weeks ago

maxakuru commented 1 month ago

cloudflare worker deploy uses the upload worker module API which overwrites settings such as logpush

we should add argument(s) to set cloudflare worker settings for the cloudflare target, at least for logpush but potentially for other worker settings

one option is to add --cloudflare-setting-{key} for the primitive value settings, for example --cloudflare-setting-logpush true to enable logpush

maxakuru commented 1 month ago

patch worker settings API for future reference

trieloff commented 1 month ago

I see two options here that could preserve the settings:

  1. prior to the PUT we GET https://developers.cloudflare.com/api/operations/worker-script-settings-get-settings (guard against 404) and then only update the script contents with https://developers.cloudflare.com/api/operations/worker-script-put-content
  2. same, but we use this PUT https://developers.cloudflare.com/api/operations/worker-script-upload-worker-module and replicate the settings that we just GETed (got)

This would not require us to add more settings and could simplify the patch a bit.

maxakuru commented 1 month ago

looking more at this.. that makes sense, avoiding many extra settings and potentially being out of sync with CF

since params are uploaded alongside the worker module, and it's possible someone adds a param after the initial deploy, I think it makes sense to go with your 2nd suggestion

adobe-bot commented 4 weeks ago

:tada: This issue has been resolved in version 11.1.12 :tada:

The release is available on:

Your semantic-release bot :package::rocket: