From 32e8a432d3b6b9ae0d836e755db779af64b51b91 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Wed, 19 Nov 2025 16:40:25 -0800 Subject: [PATCH 1/4] test(integration): enable Cloudflare integration tests in CI (#87) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add CLOUDFLARE_AUTH environment variable to CI workflow - Update cloudflare.integration.js to use process.env.CLOUDFLARE_AUTH - Update account ID and test domain for current Cloudflare account - Remove .skip from Cloudflare integration test Fixes #87 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Signed-off-by: Lars Trieloff --- .github/workflows/main.yaml | 1 + test/cloudflare.integration.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 6c0f8f4..e5c07e3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -33,6 +33,7 @@ jobs: - run: npm run integration-ci env: HLX_FASTLY_AUTH: ${{ secrets.HLX_FASTLY_AUTH }} + CLOUDFLARE_AUTH: ${{ secrets.CLOUDFLARE_AUTH }} - name: Semantic Release (Dry Run) run: npm run semantic-release-dry diff --git a/test/cloudflare.integration.js b/test/cloudflare.integration.js index 6eabcc3..3847260 100644 --- a/test/cloudflare.integration.js +++ b/test/cloudflare.integration.js @@ -35,7 +35,7 @@ describe('Cloudflare Integration Test', () => { await fse.remove(testRoot); }); - it.skip('Deploy a pure action to Cloudflare', async () => { + it('Deploy a pure action to Cloudflare', async () => { await fse.copy(path.resolve(__rootdir, 'test', 'fixtures', 'edge-action'), testRoot); process.chdir(testRoot); // need to change .cwd() for yargs to pickup `wsk` in package.json const builder = await new CLI() @@ -47,8 +47,9 @@ describe('Cloudflare Integration Test', () => { '--plugin', path.resolve(__rootdir, 'src', 'index.js'), '--arch', 'edge', '--cloudflare-email', 'lars@trieloff.net', - '--cloudflare-account-id', 'b4adf6cfdac0918eb6aa5ad033da0747', - '--cloudflare-test-domain', 'rockerduck', + '--cloudflare-account-id', '155ec15a52a18a14801e04b019da5e5a', + '--cloudflare-test-domain', 'minivelos', + '--cloudflare-auth', process.env.CLOUDFLARE_AUTH, '--package.params', 'HEY=ho', '--package.params', 'ZIP=zap', '--update-package', 'true', From b7a7cd2e21cfb4f361977d842faf883b7934c2d1 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Wed, 19 Nov 2025 17:12:19 -0800 Subject: [PATCH 2/4] fix: enable workers.dev subdomain after deployment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add enableSubdomain() method to CloudflareDeployer - Call enableSubdomain() after worker deployment - Use POST method to enable subdomain (not PUT) - Increase retry404 from 0 to 5 for propagation delays - Requires Workers Scripts:Edit permission on API token This fixes the issue where deployed workers weren't accessible on workers.dev due to subdomain not being enabled. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Signed-off-by: Lars Trieloff --- src/CloudflareDeployer.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/CloudflareDeployer.js b/src/CloudflareDeployer.js index bd4fb92..94e3aca 100644 --- a/src/CloudflareDeployer.js +++ b/src/CloudflareDeployer.js @@ -89,6 +89,8 @@ export default class CloudflareDeployer extends BaseDeployer { await this.updatePackageParams(id, this.cfg.packageParams); await this.restoreSettings(settings); + + await this.enableSubdomain(); } async getSettings() { @@ -120,6 +122,22 @@ export default class CloudflareDeployer extends BaseDeployer { return res.ok; } + async enableSubdomain() { + const res = await this.fetch(`https://api.cloudflare.com/client/v4/accounts/${this._cfg.accountID}/workers/scripts/${this.fullFunctionName}/subdomain`, { + method: 'POST', + headers: { + Authorization: `Bearer ${this._cfg.auth}`, + 'content-type': 'application/json', + }, + body: JSON.stringify({ enabled: true }), + }); + if (!res.ok) { + const { errors } = await res.json(); + this.log.warn(`Unable to enable workers.dev subdomain: ${errors[0]?.message || 'unknown error'}`); + } + return res.ok; + } + async updatePackageParams(id, params) { const kvlist = Object.entries(params).map(([key, value]) => ({ key, value, @@ -169,7 +187,7 @@ export default class CloudflareDeployer extends BaseDeployer { ? this.testRequest({ url: `https://${this.fullFunctionName}.${this._cfg.testDomain}.workers.dev`, idHeader: 'CF-RAY', - retry404: 0, + retry404: 5, }) : undefined; } From f7a1b63748c63fca9968efd06ff62a9a59d7b009 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Wed, 19 Nov 2025 17:14:10 -0800 Subject: [PATCH 3/4] test: add subdomain mock to CloudflareDeployer tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add POST /subdomain mock to both CloudflareDeployer tests - Fixes unit test failures from enableSubdomain() addition 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Signed-off-by: Lars Trieloff --- test/deploy.test.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/deploy.test.js b/test/deploy.test.js index 0d257bb..c24a360 100644 --- a/test/deploy.test.js +++ b/test/deploy.test.js @@ -56,7 +56,9 @@ describe('Deploy Test', () => { }) .reply(200, JSON.stringify({ result: { id: 'test-namespace' } })) .put('/client/v4/accounts/123/workers/scripts/default--test-worker') - .reply(200); + .reply(200) + .post('/client/v4/accounts/123/workers/scripts/default--test-worker/subdomain') + .reply(200, JSON.stringify({ result: { enabled: true, previews_enabled: true } })); process.chdir(testRoot); // need to change .cwd() for yargs to pickup `wsk` in package.json const builder = await new CLI() @@ -120,7 +122,9 @@ describe('Deploy Test', () => { bodies.settings = b; return true; }) - .reply(200); + .reply(200) + .post('/client/v4/accounts/123/workers/scripts/default--test-worker/subdomain') + .reply(200, JSON.stringify({ result: { enabled: true, previews_enabled: true } })); process.chdir(testRoot); // need to change .cwd() for yargs to pickup `wsk` in package.json const builder = await new CLI() From 570798f0982ae8cd985f1d93c33334ce8c2dd615 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Wed, 19 Nov 2025 17:17:50 -0800 Subject: [PATCH 4/4] test: update assertion for minivelos subdomain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update test assertion from rockerduck to minivelos - Matches updated account configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Signed-off-by: Lars Trieloff --- test/cloudflare.integration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cloudflare.integration.js b/test/cloudflare.integration.js index 3847260..f016c81 100644 --- a/test/cloudflare.integration.js +++ b/test/cloudflare.integration.js @@ -65,6 +65,6 @@ describe('Cloudflare Integration Test', () => { const res = await builder.run(); assert.ok(res); const out = builder.cfg._logger.output; - assert.ok(out.indexOf('https://simple-package--simple-project.rockerduck.workers.dev') > 0, out); + assert.ok(out.indexOf('https://simple-package--simple-project.minivelos.workers.dev') > 0, out); }).timeout(10000000); });