-
Notifications
You must be signed in to change notification settings - Fork 759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ensure that version secrets commands do not write wrangler config warnings #7450
Conversation
🦋 Changeset detectedLatest commit: a80fb2c The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
5a9a2e4
to
a80fb2c
Compare
@@ -54,41 +55,60 @@ describe("versions secret put", () => { | |||
expect(std.err).toMatchInlineSnapshot(`""`); | |||
}); | |||
|
|||
// For some reason, this always hangs. Not sure why |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was broken because you cannot call useMockStdin()
from within an it()
clause since itself calls things like beforeEach()
.
@@ -82,8 +82,12 @@ export function mockGetVersion(versionInfo?: VersionDetails) { | |||
function mockGetVersionContent() { | |||
msw.use( | |||
http.get( | |||
`*/accounts/:accountId/workers/scripts/:scriptName/content/v2?version=ce15c78b-cc43-4f60-b5a9-15ce4f298c2a`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was causing MockServiceWorkers (MSW) to write warnings to the console about a redundant query in the URL matcher.
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-wrangler-7450 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7450/npm-package-wrangler-7450 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-wrangler-7450 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-create-cloudflare-7450 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-kv-asset-handler-7450 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-miniflare-7450 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-pages-shared-7450 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-vitest-pool-workers-7450 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-workers-editor-shared-7450 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-workers-shared-7450 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-workflows-shared-7450 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
const configPath = | ||
args.config || (args.name && findWranglerConfig(path.dirname(args.name))); | ||
return readConfig(configPath, args); | ||
args.config || (entryPath && findWranglerConfig(path.dirname(entryPath))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future I think we could somehow roll this into readConfig()
itself and remove the need for this helper function at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, nice cleanup too. Thanks!
@@ -75,21 +75,22 @@ export function readConfig( | |||
configPath: string | undefined, | |||
// Include command specific args as well as the wrangler global flags | |||
args: ReadConfigCommandArgs, | |||
requirePagesConfig: true | |||
options: { requirePagesConfig: true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -75,6 +75,18 @@ describe("versions secret put", () => { | |||
expect(std.err).toMatchInlineSnapshot(`""`); | |||
}); | |||
|
|||
test("no wrangler configuration warnings shown", async () => { | |||
await writeFile("secrets.json", JSON.stringify({ SECRET_1: "secret-1" })); | |||
await writeFile("wrangler.json", JSON.stringify({ invalid_field: true })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, but could this use the writeWranglerConfig helper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really because that requires that the input object matches the RawConfig
type, which then requires an awkward cast.
Fixes #0000
Ensures that version secrets commands do not write wrangler config warnings.
This was a regression introduced by #7437.