graphql-ttl-transformer
graphql-ttl-transformer copied to clipboard
Unable to get my Amplify to see the plugin
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.
The Amplify docs indicate that it must be installed globally, similar to how @aws-ampify/cli is also installed.
Try npm install -g graphql-ttl-transformer
I will note here, that it seems you must have it both installed locally and globally.
npm install -g graphql-ttl-transformer
npm install graphql-ttl-transformer
Also, you cannot use it as a standard plugin because Amplify doesn't have a convention for transformers other than adding them to the transformers.conf.json.
@joekiller thank you! I tried to follow your suggestion but I'm still encountering the same issues.
One question I have is: in which folder are you installing "locally" using npm install graphql-ttl-transformer?
By locally, I mean the folder which is the parent of the the amplify directory. Ie the one in which you ran amplify init from originally. Typically that is the root folder of a project. so given project-foo/ containing the amplify/ directory I'd run the command in the project-foo/ directory.
Thank you! I did that and got the same error. I wonder if anyone else has the same issue.
That is frustrating for sure. What type of project is it which you are trying to use this with? I was running a typescript/JavaScript project. Another thing I did, which I don't know if it matters is I had nodejs 16 installed.
What version of graphql transformation are you using? Ie is it the v2 type?
Does this error occur locally or on ci? Finally what platform are you running? Macos, windows, Linux, etc.
Running on the latest macOS on a typescript webpack built project. Node version 14.15.3 on a v2 transformer.
Good to know. I'm running on the Linux and my colleague complained the plugin didn't work. They were also running macos so I wonder if there's a kludge there.
I did successful get CI running with the "install it locally and globally" trick.
Appreciate your insights! I'm confused at why it isn't noticed by more people at this point.
@AlessioVallero My colleague and I were able to work through this issue today. The crux involved Amplify using a different node_module home than what their current npm was using. In their case, they had installed amplify cli at some point using the curl script which put the amplify cli in their /usr/local/bin while later on they adopted using nvm which made npm install -g graphql-ttl-transformer ineffective to get the plugin into the same context as the amplify cli. We were able to identify the location with which amplify and then remediate by uninstalling it via somewhat brute force.
Uninstall from local:
amplify uninstall
rm /usr/local/bin/amplify
rm -rf /usr/local/lib/node_modules/\@aws-amplify/
We could then reconcile the node_module location differences by reinstall everything npm install -g @aws-amplify/cli graphql-ttl-transformer.
Hope this helps.
@AlessioVallero My colleague and I were able to work through this issue today. The crux involved Amplify using a different node_module home than what their current npm was using. In their case, they had installed amplify cli at some point using the curl script which put the amplify cli in their /usr/local/bin while later on they adopted using
nvmwhich madenpm install -g graphql-ttl-transformerineffective to get the plugin into the same context as the amplify cli. We were able to identify the location withwhich amplifyand then remediate by uninstalling it via somewhat brute force.Uninstall from local:
amplify uninstall rm /usr/local/bin/amplify rm -rf /usr/local/lib/node_modules/\@aws-amplify/We could then reconcile the node_module location differences by reinstall everything
npm install -g @aws-amplify/cli graphql-ttl-transformer.Hope this helps.
Thanks a lot! I will try it out in a couple of days and will keep you posted. 🙏
Hello, I found that upgrading npm may fix most of these issues as well. If you npm --version is older than 8, you may want to try npm install -g npm@latest. Upgrading npm helped me avoid having to install the plugin globally.
Hi Joe, I tried following all the steps you suggested above and, oddly enough, I still have the same issue.
The only difference I can think of is that I'm using yarn instead of npm in my project.
I searched around yarn amplify cli and it seems like npm is the package management of choice for Amplify, ie there are lots of unresolved or just closed due to no input issues regarding using yarn in the projects. Buyer beware I guess.
Funny enough though, the amplify cli development uses yarn. Go figure.
I searched around
yarn amplify cliand it seems like npm is the package management of choice for Amplify, ie there are lots of unresolved or just closed due to no input issues regarding using yarn in the projects. Buyer beware I guess.Funny enough though, the amplify cli development uses yarn. Go figure.
Ah, yeah that'd make sense, although the location of the node_modules should be the same. Unfortunately I have to give up for now, I'm wasting way too much time in trying to fix this. Thanks @joekiller for all your support!!!
I had success using this approach https://github.com/aws-amplify/amplify-category-api/issues/606#issuecomment-1240013390.
At this point I'm fairly certain that combining yarn and npm for plugins is a source of problems.
Closing as it seems to be fixable by using the approach explained in: https://github.com/flogy/graphql-ttl-transformer/issues/18#issuecomment-1269429457