Open nikname opened 2 years ago
Hey @nikname :wave: thanks for raising this! I was able to successfully reproduce this behavior using the provided reproduction steps. Thank you for providing those details! The root cause here is similar to https://github.com/aws-amplify/amplify-cli/issues/9063, however I'll mark this as a non-duplicate bug due to the different workflow.
As mentioned in the docs, it should be possible to write our VTL templates in a separate file. As a workaround, please try defining the VTL templates as strings inside the overrides.ts
file.
Marking as a bug š
Hey @nikname :wave: there was a bit of confusion on my part with this docs link I provided. Under the "VTL Resolvers" section it walks us through creating a custom CDK resource rather than _overriding` the GraphQL Resource. In a custom CDK resource these fs ops are permitted and we should be able to add VTL templates using the example you provided. Can you try those steps and see if that mitigates this issue?
Hello, I have the same problem but trying override OpenDomainName, I have Windows 10
import {
AmplifyApiGraphQlResourceStackTemplate,
getProjectInfo,
} from "@aws-amplify/cli-extensibility-helper";
export function override(resources: AmplifyApiGraphQlResourceStackTemplate) {
const { projectName, envName } = getProjectInfo();
// Override OpenSearch Resource Configuration
resources.opensearch.OpenSearchDomain.domainName = `${projectName}-op-${envName}`;
}
Same issue overriding storage.
Similar issue overriding opensearch.OpenSearchStreamingLambdaFunction.
ā “ Building resource api/*** Your instance type for OpenSearch is t2.small.elasticsearch, you may experience performance issues or data loss. Consider reconfiguring with the instructions here https://docs.amplify.aws/cli/graphql/search-and-result-aggregations/#set-up-opensearch-for-production-environments
š Error: Skipping override due to VMError: Cannot find module 'fs'
Overrides functionality is not implemented for this category
ā Successfully pulled backend environment *** from the cloud.
ā “ Building resource api/*** Your instance type for OpenSearch is t2.small.elasticsearch, you may experience performance issues or data loss. Consider reconfiguring with the instructions here https://docs.amplify.aws/cli/graphql/search-and-result-aggregations/#set-up-opensearch-for-production-environments
š Error: Skipping override due to VMError: Cannot find module 'fs'
Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v14.19.0
Amplify CLI Version
7.6.21
What operating system are you using?
Windows 10
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Amplify Categories
api
Amplify Commands
override, push
Describe the bug
After editing the override.ts file (generated from
amplify override api
) to add a custom resolver when I try to push the changes I see the following error in the outputš Error: Skipping override due to VMError: Cannot find module 'fs'
If I confirm the push operation I don't see my changes.
Expected behavior
See my changes
Reproduction steps
amplify override api
export function override(resources: AmplifyApiGraphQlResourceStackTemplate) { const createGroupMessageResolver = new appsync.CfnResolver(resources.api.rootstack, "PromotePost", { apiId: resources.api.GraphQLAPI.attrApiId, fieldName: "promotePost", typeName: "Mutation", requestMappingTemplate: appsync.MappingTemplate.fromFile(
${__dirname}/resolvers/Mutation.promotePost.req.vtl
).renderTemplate(), responseMappingTemplate: appsync.MappingTemplate.fromFile(${__dirname}/resolvers/Mutation.promotePost.res.vtl
).renderTemplate(), dataSourceName: "PostTable" }); }Log output
Additional information
No response