Open lazpavel opened 8 months ago
I'm able to reproduce this by removing email
from the defineAuth
template, running amplify sandbox
, which in turn produces an error. When attempting to ctrl+c I see the same issue
➜ p amplify sandbox
Unable to build Amplify backend. Check your backend definition in the `amplify` folder.
Caused By: Bundling asset amplify-amplifygen2-josef-sandbox-b6eddb8592/auth/SecretFetcherResourceProviderLambda/Code/Stage...
...3091233f22ea8ed624b7d06d4a2170d6d2865d8d59e2577d6547e30/index.js 204.2kb
⚡ Done in 83ms
/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+auth-construct-alpha@0.5.3_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/auth-construct-alpha/src/construct.ts:358
throw Error('At least one of email or phone must be enabled.');
^
Error: At least one of email or phone must be enabled.
at AmplifyAuth.AmplifyAuth.getUserPoolProps (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+auth-construct-alpha@0.5.3_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/auth-construct-alpha/src/construct.ts:358:13)
at AmplifyAuth (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+auth-construct-alpha@0.5.3_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/auth-construct-alpha/src/construct.ts:118:39)
at AmplifyAuthGenerator.generateContainerEntry (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend-auth@0.4.4_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend-auth/src/factory.ts:93:27)
at SingletonConstructContainer.getOrCompute (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend@0.10.2_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend/src/engine/singleton_construct_container.ts:45:19)
at AmplifyAuthFactory.getInstance (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend-auth@0.4.4_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend-auth/src/factory.ts:67:31)
at <anonymous> (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend@0.10.2_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend/src/backend_factory.ts:92:68)
at Array.forEach (<anonymous>)
at BackendFactory (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend@0.10.2_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend/src/backend_factory.ts:88:40)
at defineBackend (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend@0.10.2_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend/src/backend_factory.ts:120:19)
at <anonymous> (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/amplify/backend.ts:4:17)
Node.js v20.11.0
Subprocess exited with error 1
[Sandbox] Watching for file changes...
[Sandbox] Initializing...
[Sandbox] Executing command `deploy`
Unable to build Amplify backend. Check your backend definition in the `amplify` folder.
Caused By: Bundling asset amplify-amplifygen2-josef-sandbox-b6eddb8592/auth/SecretFetcherResourceProviderLambda/Code/Stage...
...3091233f22ea8ed624b7d06d4a2170d6d2865d8d59e2577d6547e30/index.js 204.2kb
⚡ Done in 13ms
/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+auth-construct-alpha@0.5.3_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/auth-construct-alpha/src/construct.ts:358
throw Error('At least one of email or phone must be enabled.');
^
Error: At least one of email or phone must be enabled.
at AmplifyAuth.AmplifyAuth.getUserPoolProps (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+auth-construct-alpha@0.5.3_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/auth-construct-alpha/src/construct.ts:358:13)
at AmplifyAuth (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+auth-construct-alpha@0.5.3_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/auth-construct-alpha/src/construct.ts:118:39)
at AmplifyAuthGenerator.generateContainerEntry (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend-auth@0.4.4_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend-auth/src/factory.ts:93:27)
at SingletonConstructContainer.getOrCompute (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend@0.10.2_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend/src/engine/singleton_construct_container.ts:45:19)
at AmplifyAuthFactory.getInstance (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend-auth@0.4.4_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend-auth/src/factory.ts:67:31)
at <anonymous> (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend@0.10.2_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend/src/backend_factory.ts:92:68)
at Array.forEach (<anonymous>)
at BackendFactory (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend@0.10.2_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend/src/backend_factory.ts:88:40)
at defineBackend (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/node_modules/.pnpm/@aws-amplify+backend@0.10.2_aws-cdk-lib@2.123.0_constructs@10.3.0_zod@3.22.4/node_modules/@aws-amplify/backend/src/backend_factory.ts:120:19)
at <anonymous> (/Users/josef/Documents/projects/aws-amplify/amplify-gen2-app/amplify/backend.ts:4:17)
Node.js v20.11.0
Subprocess exited with error 1
[Sandbox] Watching for file changes...
^C[Sandbox] Shutting down
? Would you like to delete all the resources in your sandbox environment (This
cannot be undone)? (y/N) [Sandbox] Shutting down
Error: setRawMode EIO
reproduced the second issue where the sandbox is hanging on to the process. I think my sso session expired and I saved a change in auth, then encountered the error below. When I encounter this I am forced to close my terminal.
The CloudFormation deployment has failed. Find more information in the CloudFormation AWS Console for this stack.
Caused By: ❌ Deployment failed: Error: Unable to resolve AWS account to use. It must be either configured when you define your CDK Stack, or through the environment
[Sandbox] Watching for file changes...
^C^X^C^C^C^C^C^C^C
^C^C^C
The issue is with the yarn not respecting SIGINT signal and just exiting right away leaving the children (sandbox process) hanging. because the parent process (yarn) is exited, the associated STDIO
for child are also closed, so when the prompt tries to send something to stdout
it crashes with the error setRawMode EIO
.
I had better luck with yarn 1.22.22 where atleast the shell didn't hang and was still usable. but doesn't look like we can do anything until yarn fixes that bug.
Environment information
Description
npx amplify sandbox
process not exiting gracefully oncontrol + c
. It behaves randomly incorrectnot listening to
control + c
event whennpx amplify sandbox
is in error statecontrol + c
event skips all the way without letting me respond to cleanup promptMost of the time this behavior happens when deploying sandbox env errors but occastionally noticed it on success as well.