-
Notifications
You must be signed in to change notification settings - Fork 79
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
Unable to override an autogenerated pipeline resolver #2692
Comments
Hey @jguipi, 👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂. |
As extra detail, I already copied the autogenerated resolver into the right path From: Is it normal that the file that were autogenerated are not following the naming convention mentioned here. The current files name are presented in the screenshot |
Hi @jguipi, Thanks for bringing this up. To override the resolvers, you need to copy the autogenerated resolver from |
That was already done, but when I try to add the code in the As shown above, I was not able to found the function in either of those model: const getChildModel= resources.models['Child'];
const getUserModel = resources.models['User'];
console.log(getChildModel)
console.log(getUserModel) getChildModel return getUserModel return There is no mention of that autogenerated function |
Hi @jguipi, Could we arrange a call to explore this issue in detail? |
Hey @jguipi, Are you still experiencing this issue? |
Hi ! sorry I’m currently on vacation and I don’t have my laptop. Can we have a call when I come back ? After August 10th. |
Let me know when you're available. I'm free from 3 PM Montreal time almost every day. (7 PM UTC) |
@jguipi Thanks for sharing your username. I’ll connect with you on Discord. |
Hi @jguipi, I believe the configurations you're looking for are exposed under the import { AmplifyApiGraphQlResourceStackTemplate, AmplifyProjectInfo } from '@aws-amplify/cli-extensibility-helper';
import { CfnResolver } from 'aws-cdk-lib/aws-appsync';
export function override(resources: AmplifyApiGraphQlResourceStackTemplate, amplifyProjectInfo: AmplifyProjectInfo) {
console.log('\n### resources.models:', JSON.stringify(Object.keys(resources.models)));
// ### resources.models: ["User","Child","ConnectionStack"]
console.log('\n### resources.models[ConnectionStack].resolvers:', JSON.stringify(Object.keys(resources.models['ConnectionStack']?.resolvers)));
// ### resources.models[ConnectionStack].resolvers: ["userChildrenResolver","childUserResolver"]
const model = resources.models['ConnectionStack']!;
const resolvers = model.resolvers!;
const getResolver = resolvers['userChildrenResolver']!;
console.log('### original pipelineConfig', JSON.stringify(getResolver.pipelineConfig));
// ### original pipelineConfig {"functions":["${Token[TOKEN.725]}"]}
const pipelineConfig = getResolver.pipelineConfig!;
const functions = (pipelineConfig as CfnResolver.PipelineConfigProperty).functions;
getResolver.pipelineConfig = {
functions: [
'pipelinefn1-dev',
'pipelinefn2-dev',
...functions
]
};
console.log('### updated pipelineConfig', JSON.stringify(getResolver.pipelineConfig));
// ### updated pipelineConfig {"functions":["pipelinefn1-dev","pipelinefn2-dev","${Token[TOKEN.725]}"]}
} Hope this helps |
Thank you for the reply ! I'll try this out during the weekend |
The solution worked! Thank you all for your help! In the end, the autogenerated pipeline was stored in resources.models['ConnectionStack']. Hopefully it will help other people ! |
This issue is now closed. Comments on closed issues are hard for our team to see. |
How did you install the Amplify CLI?
npm install -g @aws-amplify/cli
If applicable, what version of Node.js are you using?
v22.2.0
Amplify CLI Version
12.12.4
What operating system are you using?
mac os 14.5 (23F79)
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
no manual change were made
Describe the bug
This schema is generating an autogenerated pipeline resolver that I'm unable to override using the
amplify/backend/api/myapi/override.ts
schema.graphql
It seems like the key
User.Children
autogenerate, a resolver that I'm unable to override.Override.ts
When I log the following, I'm unable to see the autogenerated pipeline resolver in the data structure:
On the other hand, when I look at the AWS UI I'm able to see the autogenerated function
Expected behavior
Being able to override the pipeline resolver that was automatically generated by amplify
Reproduction steps
Project Identifier
No response
Log output
Additional information
No response
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: