amplify-cli
amplify-cli copied to clipboard
Export CDK doesn't work when stack contains imported auth
Before opening, please confirm:
- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v14.18.0
Amplify CLI Version
7.6.19
What operating system are you using?
mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Amplify Categories
auth
Amplify Commands
export
Describe the bug
When amplify backend stack contains imported auth (cognito user pool), amplify export command throws an error.
Expected behavior
CDK should be generated successfully.
Reproduction steps
- amplify init
- amplify import auth
- amplify export
GraphQL schema(s)
# Put schemas below this line
Log output
# Put your logs below this line
✖ Generating and writing root stack
Cannot read property 'parameters' of undefined
TypeError: Cannot read property 'parameters' of undefined
at ResourceExport.fixNestedStackParameters (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/resource-package/resource-export.ts:102:59)
at Object.run (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/export-resources.ts:50:39)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at exportBackend (/usr/local/lib/node_modules/@aws-amplify/cli/src/commands/export.ts:74:5)
at Object.run (/usr/local/lib/node_modules/@aws-amplify/cli/src/commands/export.ts:62:5)
at Object.executeAmplifyCommand (/usr/local/lib/node_modules/@aws-amplify/cli/src/index.ts:373:5)
at executePluginModuleCommand (/usr/local/lib/node_modules/@aws-amplify/cli/src/execution-manager.ts:178:3)
at executeCommand (/usr/local/lib/node_modules/@aws-amplify/cli/src/execution-manager.ts:30:5)
at Object.run (/usr/local/lib/node_modules/@aws-amplify/cli/src/index.ts:205:5)
Additional information
No response
Hey @ilkerburakkurt :wave: thanks for taking the time to file this! I've marked this as a bug to log a more helpful error message when attempting to export a stack with imported auth 🙂
Hi @josefaidt, If It could be able to export a reference to the resource as well, that would be fantastic.
The fix here is to improve the error message from amplify export to message that export of imported auth is not supported.
Is this true of any imported resource? Seeing this error message when exporting an Amplify project that imports DDB tables and S3 bucket, but not an auth module. TypeError: Cannot read property 'parameters' of undefined at ResourceExport.fixNestedStackParameters
Hi ! Have same issue as well with amplify cli 9.1.0.
🛑 Cannot read property 'parameters' of undefined
TypeError: Cannot read property 'parameters' of undefined
at ResourceExport.fixNestedStackParameters (/snapshot/repo/build/node_modules/amplify-provider-awscloudformation/lib/resource-package/resource-export.js:144:59)
at Object.run (/snapshot/repo/build/node_modules/amplify-provider-awscloudformation/lib/export-resources.js:94:39)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async exportBackend (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/commands/export.js:86:9)
at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/commands/export.js:74:9)
at async Object.executeAmplifyCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:292:9)
at async executePluginModuleCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:142:5)
at async executeCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:40:9)
at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:165:13)```
Is there any update on this one please?
Still getting this error:
✖ Generating and writing root stack
🛑 Cannot read property 'parameters' of undefined
TypeError: Cannot read property 'parameters' of undefined
at ResourceExport.fixNestedStackParameters (/snapshot/repo/build/node_modules/amplify-provider-awscloudformation/lib/resource-package/resource-export.js:144:59)
at Object.run (/snapshot/repo/build/node_modules/amplify-provider-awscloudformation/lib/export-resources.js:94:39)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async exportBackend (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/commands/export.js:86:9)
at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/commands/export.js:74:9)
at async Object.executeAmplifyCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:292:9)
at async executePluginModuleCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:142:5)
at async executeCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:40:9)
at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:165:13)
Could really use a better error message, updated documentation, or a workaround
Same, amplify really sucks... I wish I could simply use the graphql transformer as part as my CDK...
Got the same issue as well here, amplify 10.0.0
Hi @josefaidt, do you have any news on this ? we are facing the same issue with amplify 10.3.0 and 10.3.1. The issue is that we cannot really understand what is going wrong as the message is not informative and there is no exhaustive documentation and troubleshooting about the export. Also, the diagnose --send-report stop before sending, that reduce drastically the help we can receive.
Was anyone able to find a work-around for this issue? I've invested a lot of time on building my app using amplify, and can't afford to abandon amplify altogether because of this :(
The error is obscure:
✖ Generating and writing root stack 🛑 Cannot read properties of undefined (reading 'parameters')
During generating the root stack the error occurs because the nestedStack will not exist so .parameters is null. thus the error.
buildOverridesEnabledResources is only called during init with the context while during push it is called with both the context and a resource tree.
So being that push calls prepareBuildableResources which does the same 'packageResource' as packageBuildWriteResources does when it invokes packageResources, perhaps
buildOverridesEnabledResources should be called after packageBuildWriteResources calls packageResources.
This is still not working in 12.7.1 Only way I have found to bypass this for s3 imported bucket is doing a amplify remove storage and making sure to not push those changes, then exporting it. But it would be great to have a export of reference to the resource.
Hey @DarylSerrano, @joekiller, and folks in the thread :wave: apologies for the delay here but I wanted to provide a quick update! Unfortunately amplify export does not currently support exporting when an imported resource exists in the project, and with this bug we aim to improve the error messaging to communicate this limitation.
Moving forward we will look into the suggested solution from @joekiller
@josefaidt or @nadetastic with Dan's comment here, on #12631, it makes me think perhaps this isn't needed anymore? Could y'all give me a gut check. I haven't kept up much recently.
I'm seeing this error as well. Googling it got me here. The error message is still wholly ambiguous.
✖ Generating and writing root stack
🛑 Cannot read properties of undefined (reading 'parameters')
I'd also like to request additional docs are added here to reference limitations like this.