-
Notifications
You must be signed in to change notification settings - Fork 4k
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(cli): failure if account cache is malformed #10887
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,6 +229,9 @@ async function initCommandLine() { | |
return cli.list(args.STACKS, { long: args.long }); | ||
|
||
case 'diff': | ||
console.log(configuration.context); | ||
console.log(configuration.context.all); | ||
console.log(configuration.context.get(cxapi.ENABLE_DIFF_NO_FAIL)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume these were for diagnostic purposes and should be removed. |
||
const enableDiffNoFail = isFeatureEnabled(configuration, cxapi.ENABLE_DIFF_NO_FAIL); | ||
return cli.diff({ | ||
stackNames: args.STACKS, | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -83,6 +83,9 @@ export class AccountAccessKeyCache { | |||||
// File doesn't exist or is not readable. This is a cache, | ||||||
// pretend we successfully loaded an empty map. | ||||||
if (e.code === 'ENOENT' || e.code === 'EACCES') { return {}; } | ||||||
// File is not JSON, could be corrupted because of concurrent writes. | ||||||
// Again, an empty cache is fine. | ||||||
if (e instanceof SyntaxError) { return {}; } | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Im actually not sure this is because of the parallelism of the integ tests, i remember @rix0rrr and I encountered this issue a few months ago and ended up in a rabbit hole of sdk code. What if we set the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This specifically has nothing to do with the SDK. This file is completely under our control, written and read by us only. I can't imagine it being anything other than the parallelism we introduced recently, given that I haven't seen this error crop up before that. I'm open to another explanation of the available facts if you have them, and I'll agree it breaks my mental model of how I thought NodeJS worked as well. Even concurrency isn't the ultimate root cause, I'm not concerned about this fix too much, which is why I'm hesitant to do more complicated workarounds. This is all to say: I say we ship it :). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uh umm. It might also be this: aws-cdk/packages/aws-cdk/lib/api/aws-auth/account-cache.ts Lines 92 to 93 in ddff369
But even given that I don't mind too much to put this workaround in. It will also catch malformed caches for other reasons (outside our control). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ship and may the force be with you 👍 |
||||||
throw e; | ||||||
} | ||||||
} | ||||||
|
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.
Intentional...?