Open hisham opened 1 year ago
Hi @hisham, Thank you for raising this. It appears that this issue is a duplicate of #1695. Would you mind upgrading to CLI 12.3.0 and let us know the outcome?
Upgrading to 12.3.0 does not fix. However, we do have have custom transformers that are using ""@aws-amplify/graphql-transformer-core": "^1.2.0"", and if I disable these custom transformers the gql-compile command succeeds.
So the comment in https://github.com/aws-amplify/amplify-category-api/issues/1695 about updating to graphql-transformer-core to 1.3.5 may be the solution. I'll work on updating the custom graphql directives.
Upgrading @aws-amplify/graphql-transformer-core to 1.4.0 on the custom graphql directive packages works. However updating it to 2.1.0 or above causes "AssetProvider not initialized" error. What is this error all about?
After upgrading our custom transformers to use @aws-amplify/graphql-transformer-core@1.4.0, I am now able to use the latest amplify cli (12.5.1).
Only issue is if in the future we update our transformers to reference "@aws-amplify/graphql-transformer-core" 2.0+, I would have to look into what this ""AssetProvider not initialized" error is all about.
Encountered same issue for a custom transformer of my own. Downgrading to @aws-amplify/graphql-transformer-core@1.4.0 indeed resolved the error.
Here is more info for anyone trying to debug this in the future.
I can reproduce the same error message by forking amplify-category-api repo locally and pointing the transform.conf.json to
"transformers": [
"file:///Users/ollie/Work/amplify-category-api/packages/amplify-graphql-function-transformer/lib/index.js"
]
here is the verbose crash log:
🛑 AssetProvider not initialized
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
DeploymentFault: AssetProvider not initialized
at Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/push-resources.js:362:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:137:16
at async Promise.all (index 0)
at async providersPush (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:133:5)
at async AmplifyToolkit.pushResources (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:107:13)
at async Object.executeAmplifyCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:194:9)
at async executePluginModuleCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:139:5)
at async executeCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:37:9)
at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:121:5)
AssetProvider not initialized
Error: AssetProvider not initialized
at AssetManager.getAssetProvider (/Users/ollie/Work/amplify-category-api/packages/amplify-graphql-transformer-core/lib/transformer-context/asset-manager.js:10:19)
at AssetManager.createAsset (/Users/ollie/Work/amplify-category-api/packages/amplify-graphql-transformer-core/lib/transformer-context/asset-manager.js:6:21)
at S3MappingTemplate.bind (/Users/ollie/Work/amplify-category-api/packages/amplify-graphql-transformer-core/lib/cdk-compat/template-asset.js:59:55)
at new AppSyncFunctionConfiguration (/snapshot/amplify-cli/build/node_modules/@aws-amplify/graphql-transformer-core/lib/appsync-function.js:12:62)
at DefaultTransformHost.addAppSyncFunction (/snapshot/amplify-cli/build/node_modules/@aws-amplify/graphql-transformer-core/lib/transform-host.js:78:24)
at /Users/ollie/Work/amplify-category-api/packages/amplify-graphql-function-transformer/lib/graphql-function-transformer.js:84:49
at Array.forEach (<anonymous>)
at /Users/ollie/Work/amplify-category-api/packages/amplify-graphql-function-transformer/lib/graphql-function-transformer.js:68:29
at Map.forEach (<anonymous>)
at FunctionTransformer.generateResolvers (/Users/ollie/Work/amplify-category-api/packages/amplify-graphql-function-transformer/lib/graphql-function-transformer.js:67:33)
at GraphQLTransform.transform (/snapshot/amplify-cli/build/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.js:172:29)
at executeTransform (/snapshot/amplify-cli/build/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js:80:19)
at buildAPIProject (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-api/lib/graphql-transformer/transform-graphql-schema-v2.js:146:48)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async transformGraphQLSchemaV2 (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-api/lib/graphql-transformer/transform-graphql-schema-v2.js:114:31)
at async transformGraphQLSchema (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-api/lib/graphql-transformer/transform-graphql-schema.js:11:43)
at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/push-resources.js:169:7)
at async /snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:137:16
at async Promise.all (index 0)
at async providersPush (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:133:5)
at async AmplifyToolkit.pushResources (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:107:13)
at async Object.executeAmplifyCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:194:9)
at async executePluginModuleCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:139:5)
at async executeCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:37:9)
at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:121:5)
This is probably a good place to start debugging for anyone brave enough.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
18.16.1
Amplify CLI Version
12.2.4
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
When running 'amplify api gql-compile' / amplify push I get the following error:
"🛑 template.substituteValues is not a function"
Expected behavior
Graphql schema should compile succesfully
Reproduction steps
Not sure but I sent my project configurations.
Project Identifier
3def1a2bd59d61900f734d59f169a578
Log output
Additional information
No response
Before submitting, please confirm: