Open eliecer2000 opened 2 years ago
Hey @eliecer2000 :wave: thanks for raising this! Unfortunately this is not currently supported in our amplify export
workflow. Marking as a feature request 🙂
@josefaidt So it seems that there is more problems with amplify export
.
9.2.1
macOS Monterey
backend/auth/<name>/override.ts
import {AmplifyAuthCognitoStackTemplate} from '@aws-amplify/cli-extensibility-helper';
export function override(resources: AmplifyAuthCognitoStackTemplate) { const lambdaArn = { "Fn::ImportValue" : { "Fn::Join": [ "-", [ "cognito-sender", {"Fn::Select": [0, {"Fn::Split": ["-", {"Ref": "env"}]}]}, "bla-arn" ] ] } }
const kmsKey = { "Fn::ImportValue" : { "Fn::Join": [ "-", [ "cognito-sender", {"Fn::Select": [0, {"Fn::Split": ["-", {"Ref": "env"}]}]}, "key-arn" ] ] } }
resources.addCfnResource({ // @ts-ignore "type" : "AWS::Lambda::Permission", "properties" : { "Action" : "lambda:InvokeFunction", "FunctionName" : lambdaArn, "Principal" : "cognito-idp.amazonaws.com", "SourceArn" : resources.userPool.getAtt("Arn") } }, "lambdaPermission") }
3. Make sure that `export-amplify-stack` does not exist
4. Run `amplify export`
5. All good at this stage
6. Modify `backend/auth/<name>/override.ts` you can change `lambdaArn` or whatever, it doesn't matter
7. Run again `amplify export`
8. You will be asked:
✔ Existing files at /Users/project/export-amplify-stack/amplify-export-project will be deleted and new files will be generated, continue? (Y/n) · yes
9. Files will not be overridden, to achieve that you have to remove whole `export-amplify-stack` directory
### Describe the bug (2)
1. Create file `backend/api/<name>/override.ts`
2. Add any customisation
import {AmplifyApiGraphQlResourceStackTemplate} from '@aws-amplify/cli-extensibility-helper';
export function override(resources: AmplifyApiGraphQlResourceStackTemplate) { resources.api.GraphQLAPI.xrayEnabled = true }
3. Make sure that `export-amplify-stack` does exist
4. Run `amplify export`
5. You will be asked (DO NOT DO ANYTHING):
✔ Existing files at /Users/project/export-amplify-stack/amplify-export-project will be deleted and new files will be generated, continue? (Y/n)
6. Now, at this stage your `amplify/backend/api/Project/build/cloudformation-template.json` will contain change:
}, "XrayEnabled": true
7. Press `Y` and process with `amplify export`
8. Poof, there is no more your changes, they got reverted
@josefaidt any update on this one?
Before opening, please confirm:
How did you install the Amplify CLI?
npm install -g @aws-amplify/cli
If applicable, what version of Node.js are you using?
v16.14.0
Amplify CLI Version
8.0.1
What operating system are you using?
Ubuntu
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Amplify Categories
Not applicable
Amplify Commands
export
Describe the bug
I tell you a problem I have with a project created with AWS Amplify, I have with several resolvers in the preLoadData stage, unfortunately I did not find an elegant solution to place them
dataSourceName
until I used the overwrite strategy in the API, when I deploy with the CLI it works great, the problem comes when I try to export my project to CDK the overrider does not work, in the build stage when exporting it does not make this call, you can even try to execute theamplify build
command and you will see that if the overrider file is executed, it does not work when I executeamplify export
.Expected behavior
That replaces all the dataSourceName as it does when I run
amplify push
Reproduction steps
amplify export --out folder-export
GraphQL schema(s)
Log output
Additional information
No response