-
Notifications
You must be signed in to change notification settings - Fork 66
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
cdk error mapping EPERM errors relating to synth.lock #2293
Conversation
🦋 Changeset detectedLatest commit: 1234ebb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
@@ -359,6 +359,12 @@ const testErrorMappings = [ | |||
errorName: 'FilePermissionsError', | |||
expectedDownstreamErrorMessage: `EACCES: permission denied, unlink '.amplify/artifacts/cdk.out/synth.lock'`, | |||
}, | |||
{ | |||
errorMessage: `EPERM: operation not permitted, rename 'C:/Users/someUser/amplify/artifacts/cdk.out/synth.lock.6785_1' → 'C:/Users/someUser/amplify/artifacts/cdk.out/synth.lock'`, |
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 is an error that only appears to Windows users, so using Windows file path structure here
@@ -184,6 +184,15 @@ export class CdkErrorMapper { | |||
errorName: 'FilePermissionsError', | |||
classification: 'ERROR', | |||
}, | |||
{ | |||
errorRegex: | |||
/EPERM: operation not permitted, rename (?<fileName>.*) → 'C:(.*)synth.lock(.*)/, |
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.
/EPERM: operation not permitted, rename (?<fileName>.*) → 'C:(.*)synth.lock(.*)/, | |
/EPERM: operation not permitted, rename (?<fileName>(.*)\/synth\.lock\.\S+) → '(.*)\/synth\.lock'/, |
So that:
- We can drop
C:
letter (what if project is onD:
?) - File name capture is more precise.
- Dots are special characters in regex, escaped them.
- Do we need trailing
(.*)
?
resolutionMessage: | ||
'Check that you have the right permissions to rename this file and try running the command again', |
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.
These EPERM
on Windows are likely related to concurrent access.
See https://www.google.com/search?q=eperm+windows+concurrent+access+to+file&rlz=1C5GCCM_en&oq=eperm+windows+concurrent+access+to+file&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCDY2NjRqMGo3qAIAsAIA&sourceid=chrome&ie=UTF-8 .
it could be permissions but it's more likely concurrent access and simple re-try may resolve it.
Could you please update the message to convey that possibility?
/EPERM: operation not permitted, rename (?<fileName>(.*)\/synth\.lock\.\S+) → '(.*)\/synth\.lock'/, | ||
humanReadableErrorMessage: 'Not permitted to rename file: {fileName}', | ||
resolutionMessage: | ||
'Try running the command again and check that no other process has this file open and that you have the right permissions to rename this file', |
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.
synth.lock
files are not managed by customers, but CDK. Customers would have no idea what "no other process has this file open" or "permissions to rename this file" might mean. I'd simplify to
'Try running the command again and check that no other process has this file open and that you have the right permissions to rename this file', | |
'Try running the command again and ensure that only one sandbox instance is running. If it still doesn't work check permissions of `.amplify` folder', |
Problem
Error like
EPERM: operation not permitted, rename 'C:\Users\[...]\.amplify\artifacts\cdk.out\synth.lock.45040_1' → 'C:\Users\[...]\.amplify\artifacts\cdk.out\synth.lock'
not mapped properly.Updated
The stack named _stackName_ is in a failed state. You may need to delete it from the AWS console : DELETE_FAILED
resolution message to suggest looking at original error message, has additional info about cause of error.Issue number, if available: N/A
Changes
Handles errors like
EPERM: operation not permitted, rename 'C:\Users\[...]\.amplify\artifacts\cdk.out\synth.lock.45040_1' → 'C:\Users\[...]\.amplify\artifacts\cdk.out\synth.lock'
.Checklist
run-e2e
label set.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.