flogy / graphql-ttl-transformer Goto Github PK
View Code? Open in Web Editor NEW♻ Enable DynamoDB's time-to-live feature to auto-delete old entries in your AWS Amplify API!
License: MIT License
♻ Enable DynamoDB's time-to-live feature to auto-delete old entries in your AWS Amplify API!
License: MIT License
Hello,
"transformers": ["graphql-ttl-transformer"]
"graphql-ttl-transformer": "^2.0.0"
,"transformerversion": 2
in the cli.json
file.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/**/*
This plugin needs to be upgraded to use CDK v2, otherwise, you will get the "construct does not have an associated node. All constructs must extend the "Construct" base class" error when pushing.
Thanks a lot!
One small remark: Isn't it more appropriate to use the AWSTimestamp scalar type instead of Int?
Hello! :)
I'm trying to add the plugin to my Amplify environment, I'm using version 2 of the transformer.
I followed the instructions and added it by running npm install --save graphql-ttl-transformer
and then edited the amplify/backend/api/<YOUR_API>/transform.conf.json
file, as instructed.
However, I get the error below in response.
Furthermore, I tried adding the plugin manually with the command amplify plugin add
and the I provided the absolute path to the plugin and I received the following error.
Any advice? I'm using Amplify version 9.2.1.
See aws-amplify/amplify-category-api#1897
Requires an upgrade. PR is coming...
👋 This is Rene from the AWS Amplify team! First off, THANK YOU for your amazing plugin!
I have some great news to share, we've rewritten the GraphQL Transformer plugin from the ground up to take advantage of some really amazing capabilities. All the details here: aws-amplify/amplify-cli#6217 (comment)
In order to make this plugin forward compatible with GraphQL Transformer v2, you need to make some tiny adjustments to the classes you inherit from. Migration steps here: https://gist.github.com/renebrandel/0b9537e2016e3dd9ed6d794b30b2e3f4
Happy to also hop on a call with you to walk you through the process. Email me at any time: renbran at amazon dot com
Hi and thanks for this transformer,
I have followed your npm install instruction and also added a transformers
field with graphql-ttl-transformer
to transform.conf.json
like this:
{
"Version": 5,
"ElasticsearchWarning": true,
"transformers": [
"graphql-ttl-transformer"
]
}
I can successfully deploy the backend with amplify push
but when I try to deploy the frontend, the build fails with the following warning: Unable to import custom transformer module(graphql-ttl-transformer)
.
Here is the relevant part of the build log.
2021-01-19T12:01:24.851Z [INFO]: �[31mUnable to import custom transformer module(graphql-ttl-transformer).�[39m
2021-01-19T12:01:24.852Z [INFO]: �[31mYou may fix this error by editing transformers at /codebuild/output/src127667145/src/janky-app/amplify/backend/api/janky/transform.conf.json�[39m
2021-01-19T12:01:24.852Z [WARNING]: ✖ An error occurred when pushing the resources to the cloud
2021-01-19T12:01:24.852Z [WARNING]: ✖ There was an error initializing your environment.
2021-01-19T12:01:24.854Z [INFO]: �[31minit failed�[39m
2021-01-19T12:01:24.855Z [INFO]: �[0m/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/import-global/index.js:1�[0m
�[0mError: Cannot find module '/root/.nvm/versions/node/v12.19.0/lib/node_modules/graphql-ttl-transformer'�[0m
�[0mRequire stack:�[0m
�[0m- /root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/import-global/index.js�[0m
�[0m- /root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/transform-graphql-schema.js�[0m
�[0m- /root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/push-resources.js�[0m
�[0m- /root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/amplify-service-migrate.js�[0m
�[0m- /root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/initializer.js�[0m
�[0m- /root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/index.js�[0m
�[0m- /root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/lib/init-steps/s2-initProviders.js�[0m
�[0m- /root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/lib/commands/init.js�[0m
�[0m- /root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/lib/index.js�[0m
�[0m- /root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/bin/amplify�[0m
�[0m at Object.module.exports [as default] (/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/import-global/index.js:9:10)�[0m
�[0m at /root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/transform-graphql-schema.ts:111:44�[0m
�[0m at Array.map (<anonymous>)�[0m
�[0m at Object.transformersFactory (/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/transform-graphql-schema.ts:80:8) {�[0m
�[0m code: 'MODULE_NOT_FOUND',�[0m
�[0m requireStack: [�[0m
�[0m '/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/import-global/index.js',�[0m
�[0m '/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/transform-graphql-schema.js',�[0m
�[0m '/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/push-resources.js',�[0m
�[0m '/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/amplify-service-migrate.js',�[0m
�[0m '/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/initializer.js',�[0m
�[0m '/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/index.js',�[0m
�[0m '/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/lib/init-steps/s2-initProviders.js',�[0m
�[0m '/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/lib/commands/init.js',�[0m
�[0m '/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/lib/index.js',�[0m
�[0m '/root/.nvm/versions/node/v12.19.0/lib/node_modules/@aws-amplify/cli/bin/amplify'�[0m
�[0m ]�[0m
�[0m}�[0m
2021-01-19T12:01:24.871Z [ERROR]: !!! Build failed
2021-01-19T12:01:24.872Z [ERROR]: !!! Non-Zero Exit Code detected
2021-01-19T12:01:24.872Z [INFO]: # Starting environment caching...
2021-01-19T12:01:24.872Z [INFO]: # Environment caching completed
Terminating logging...
Any help much appreciated! Thanks
Hi,
will this feature be automated in the future ?
I have no transform.conf.json file in my Amplify back-end.
The below line seems to fail when I do amplify push.
I get the error:
An error occurred during the push operation: /
acc.getResource is not a function
Hi, thank you for writing this!
Question for you - is the int option saying I can have a "dynamic" ttl like 30 days, instead of a specific timestamp? What would the units be there?
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.