Cannot find module 'graphql-auto-transformer'
pcvvelzen opened this issue · 4 comments
After following the installation instructions (step1) with npm install and (step 2) adding graphql-auto-transformer to the transform.conf.json
file of my Amplify API:
{
"Version": 5,
"transformers": [
"graphql-auto-transformer"
]
}
When attempting to use @auto directive in my model
type Post @model {
[...]
createdAt: AWSDateTime! @auto
}
I get the following error
$ amplify push -y
- Fetching updates to backend environment: dev from the cloud.
√ Successfully pulled backend environment dev from the cloud.
Current Environment: dev
| Category | Resource name | Operation | Provider plugin |
| -------- | ----------------------------------- | --------- | ----------------- |
| Api | pocapi | Update | awscloudformation |
| Auth | userPoolGroups | No Change | awscloudformation |
| Auth | pocapixxxxxxxxx | No Change | awscloudformation |
| Hosting | S3AndCloudFront | No Change | awscloudformation |
× An error occurred when pushing the resources to the cloud
Unknown directive "auto".
An error occurred during the push operation: Unknown directive "auto".
When removing the @auto directory from my schema and running amplify push -y
I get the error that graphql-auto-transformer
module could not be found, while the module is present in .\node_modules\graphql-auto-transformer
(after being installed through npm as mentioned in the readme.MD
).
$ amplify push -y
- Fetching updates to backend environment: dev from the cloud.
√ Successfully pulled backend environment dev from the cloud.
Current Environment: dev
| Category | Resource name | Operation | Provider plugin |
| -------- | ----------------------------------- | --------- | ----------------- |
| Api | pocapi | Update | awscloudformation |
| Auth | userPoolGroups | No Change | awscloudformation |
| Auth | pocapixxxxxxxxx | No Change | awscloudformation |
| Hosting | S3AndCloudFront | No Change | awscloudformation |
Unable to import custom transformer module(graphql-auto-transformer).
You may fix this error by editing transformers at ~\poc\amplify\backend\api\pocapi\transform.conf.json
× An error occurred when pushing the resources to the cloud
Cannot find module 'graphql-auto-transformer'
Require stack:
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\lib\transform-graphql-schema.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\lib\push-resources.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\lib\amplify-service-migrate.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\lib\initializer.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\index.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\lib\commands\push.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\lib\index.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\bin\amplify
An error occured during the push operation: Cannot find module 'graphql-auto-transformer'
Require stack:
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\lib\transform-graphql-schema.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\lib\push-resources.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\lib\amplify-service-migrate.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\lib\initializer.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\index.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\lib\commands\push.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\lib\index.js
- C:\Users\PC\AppData\Roaming\npm\node_modules\@aws-amplify\cli\bin\amplify
This was only resolved through installing the package globally: npm install graphql-auto-transformer -g
.
Note: I am not certain as if this issue is related to this package, or to the Amplify CLI perhaps containing a bug in combination with Windows, with finding the correct relative path to ./node_nodules/graphql-auto-transformer
Did you try export NODE_PATH=./node_modules
?
https://github.com/hirochachacha/graphql-auto-transformer#4-export-node_path
let me know if the issue persists
I did have to run npm i -g graphql-auto-transformer
in the build step to get it working.
I did have to run
npm i -g graphql-auto-transformer
in the build step to get it working.
How do you add this to build step?