graphql-ttl-transformer
graphql-ttl-transformer copied to clipboard
AWS Amplify Build - Cannot Find graphql-ttl-transformer
Hello,
- I have read this article offering a build solution.
- I have added this to my transform.conf.json file
"transformers": ["graphql-ttl-transformer"] - I have installed this package on my project
"graphql-ttl-transformer": "^2.0.0", - The localhost ttl fields via graphql schema work and show in DynamoDB
- I am using Next.js and AWS Amplify
- I am using
"transformerversion": 2in thecli.jsonfile.
Error: 🛑 Unable to import custom transformer module(graphql-ttl-transformer). 🛑 You may fix this error by editing transformers at graphql-ttl-transformer/transform.conf.json ✖ An error occurred when pushing the resources to the cloud ✖ There was an error initializing your environment. Cannot find module '/root/.amplify/lib/node_modules/graphql-ttl-transformer'
Build File for AWS Amplify Hosting:
version: 1
frontend:
phases:
preBuild:
commands:
- npm install
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
~~Regarding your question, the spec presented is confusing as these errors typically present themselves during the backend phase of the build. Are you sure this is the build taking place?~~
~~Regardless, the solution, which I have mentioned in https://github.com/aws-amplify/amplify-category-api/issues/606#issuecomment-1238488189, seems to be to both install the plugin locally and globally.~~
~~npm install -g graphql-ttl-transformer npm install graphql-ttl-transformer~~
Just to be clear, the best solution is updating npm to a version greater than 8. See my comment here: https://github.com/flogy/graphql-ttl-transformer/issues/3#issuecomment-1240023750
Closing as it seems to be fixable by using the approach explained in: https://github.com/flogy/graphql-ttl-transformer/issues/19#issuecomment-1240027937