Closed joebernard closed 5 years ago
@joebernard Can you share your annotated schema? I’ve seen this error when there’s not a single annotation in the schema.
I chose to let the tool create a new schema with a single type (myType).
type MyType @model {
id: ID!
title: String!
content: String!
price: Int
rating: Float
}
Also, I just updated to @aws-amplify/cli@0.1.28-beta.0 and the issue seems to be fixed in that version.
Hi Joe,
I got the same error that "ENOENT: no such file or directory, scandir 'amplify\backend\api\CLAGraphQL\build\resolvers'"
Thanks for directing to use @aws-amplify/cli@0.1.28-beta.0 instead, but I am facing the below issue however:
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN inquirer-autocomplete-prompt@1.0.1 requires a peer of inquirer@^5.0.0 | | ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! path C:\Users\userid\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\npm\node_modules\ansistyles npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall rename npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\userid\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\npm\node_modules\ans istyles' -> 'C:\Users\userid\AppData\Roaming\npm\node_modules\@aws-amplify\cli \node_modules\npm\node_modules.ansistyles.DELETE' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\userid\AppData\Roaming\npm-cache_logs\2018-10-15T03_13_54_462Z-debug.log
Any thoughts on the above error?
Update on this: I tried setting up a new API with amplify and got the resolvers issue. I'm using @aws-amplify/cli@0.1.28-beta.0.
I ran amplify remove api
then amplify add api
, went through the setup steps and it worked.
The only difference was in the failed attempt I specified an existing graphQL schema, and in the successful attempt I did not.
@SudduK That looks like a different issue. Open a new ticket.
@joebernard : Will create a new ticket for issue with Amplify CLI installation version 0.1.28-beta.0
However, the underlying issue with "scandir resolvers not found" still exists for me with @aws-amplify/cli@0.1.27 ENOENT: no such file or directory, scandir 'amplify\backend\api\CLAGraphQL\build\resolvers'
I followed below steps to push the new Graphql API service to AWS AppSync using the Graphql schema (.graphql) which indeed was generated from a AppSync Project in AWS Console.
1) Exported the AWS AppySync schema from AWS console in .Graphql format 2) Install the AWS Amplify CLI npm install -g @aws-amplify/cli 3) Create a amplify project amplify init 3) Create a new Graphql API amplify api add 4) Push the GraphQL Api to the AWS AppSync amplify api push Facing the error at step 4. ENOENT: no such file or directory, scandir 'amplify\backend\api\CLAGraphQL\build\resolvers'
Note: Have also tried to copy the resolver .vtl files into both directory amplify\backend and also amplify\backend\api\CLAGraphQL\build\resolvers and that failed to work
Please let me know if you have figured out this issue or see any thing that is missing in the above steps Thank you!
Same issue.
I have tried three versions(0.1.27, 0.1.28-beta.0, 0.2.0-alpha.0a106b94) and still got an error.
I chose "Do you have and annotated GraphQL schema" as "Y" and selected existing schema file exported from AWS Appsync console.
realjangsun at realjangsunui-MacBook-Pro in ~/workspace/signal9/icon-css/amplify on master [!]
$ amplify api add
? Please select from one of the below mentioned services GraphQL
? Provide API name: iconcss
? Choose an authorization type for the API API key
? Do you have an annotated GraphQL schema? Yes
? Provide your schema file path: /Users/realjangsun/Downloads/schema.graphql
GraphQL schema compiled successfully. Edit your schema at /Users/realjangsun/workspace/signal9/icon-css/amplify/backend/api/iconcss/schema.graphql
Successfully added resource iconcss locally
Some next steps:
"amplify push" will build all your local backend resources and provision it in the cloud
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud
It compiled successfully. But when I try to push it an error occurs
realjangsun at realjangsunui-MacBook-Pro in ~/workspace/signal9/icon-css/amplify on master [!]
$ amplify push
| Category | Resource name | Operation | Provider plugin |
| -------- | ------------- | --------- | ----------------- |
| Api | iconcss | Create | awscloudformation |
? Are you sure you want to continue? true
GraphQL schema compiled successfully. Edit your schema at /Users/realjangsun/workspace/signal9/icon-css/amplify/backend/api/iconcss/schema.graphql
✖ An error occurred when pushing the resources to the cloud
ENOENT: no such file or directory, scandir '/Users/realjangsun/workspace/signal9/icon-css/amplify/backend/api/iconcss/build/resolvers'
OS: Mac 10.13.6 Node: 9.4.0
Try removing the API, then adding it again. I found that it would fail the first time, but if I dropped it and re-added it, it worked.
amplify remove api
amplify add api
@SunJang AND @SudduK Could you please share your annotated schemas?
@kaustavghosh06 Unfortunately, I delete all (I am still under testing)
As far as I remember, if I create api by "amplify api add" then it fails when trying to push. But if I create api by "amplify codegen add --appId xxxxxxxxxxxxx", it worked.
@kaustavghosh06 Please find the graphql schema I am trying to add. `schema { query: Query mutation: Mutation subscription: Subscription }
type Conversation {
createdAt: String
id: ID!
messages(after: String, first: Int): MessageConnection
name: String! }
type Message {
authorId
is only available because we list it in extraAttributes
in Conversation.messages
author: User
content: String!
conversationId: ID!
createdAt: String
id: ID!
isSent: Boolean recipient: User sender: String }
type MessageConnection { messages: [Message] nextToken: String }
type Mutation {
createConversation(createdAt: String, id: ID!, name: String!): Conversation
createMessage(content: String, conversationId: ID!, createdAt: String!, id: ID!): Message
createUser(username: String!): User
createUserConversations(conversationId: ID!, userId: ID!): UserConversations }
type Query {
allMessage(after: String, conversationId: ID!, first: Int): [Message]
allMessageConnection(after: String, conversationId: ID!, first: Int): MessageConnection allMessageFrom(after: String, conversationId: ID!, first: Int, sender: String!): [Message]
allUser(after: String, first: Int): [User]
me: User }
type Subscription {
subscribeToNewMessage(conversationId: ID!): Message @aws_subscribe(mutations : ["createMessage"]) subscribeToNewUCs(userId: ID!): UserConversations @aws_subscribe(mutations : ["createUserConversations"]) subscribeToNewUsers: User @aws_subscribe(mutations : ["createUser"]) }
type User {
cognitoId: ID!
conversations(after: String, first: Int): UserConverstationsConnection
id: ID!
messages(after: String, first: Int): MessageConnection
registered: Boolean
username: String! }
type UserConversations { associated: [UserConversations] conversation: Conversation conversationId: ID! user: User userId: ID! }
type UserConverstationsConnection { nextToken: String userConversations: [UserConversations] }
type schema { mutation: Mutation query: Query subscription: Subscription } ` Basically, this is the schema of the AWS AppSync API that is already provisioned using the Chat App (sample Project) in AWS Console and all the dynamodb resources are also provisioned. (Not sure if I going right path!!) I am trying to generate the client-side typescript code for this project to be used in angular6 application
When trying to push the schema to cloud using "amplify api push", getting the below error:
| Category | Resource name | Operation | Provider plugin | | Api | ChatTestSample | Create | awscloudformation | ? Are you sure you want to continue? true GraphQL schema compiled successfully. Edit your schema at "..\AWSAmplify\amplify\backend\api\ChatTestSample/schema.graphql" x An error occurred when pushing the resources to the cloud
ENOENT: no such file or directory, scandir '..\AWSAmplify\amplify\backend\api\ChatTestSample\build\resolvers'
@SudduK You would need to add at least one annotation to your annotate schema for it to be successfully compiled and pushed. For more information on GraphQL annotated schemas, please check out -> https://github.com/aws-amplify/amplify-cli/blob/master/graphql-transform-tutorial.md
@kaustavghosh06 Thanks Kaustav. I will go through this reference and let you know what I find out. (ignored this earlier)
The below worked for me as well, except that I have setup apiKey in addition to what @SunJang commented above. amplify add codegen --apiId XXXXXXX --apiKey XXXXXXX Thanks everyone
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels for those types of questions.
Describe the bug After adding a graphql API and pushing I receive this error: ENOENT: no such file or directory, scandir '/opt/projects/myApp/amplify/backend/api/myApp/build/resolvers'
To Reproduce Steps to reproduce the behavior:
amplify init
amplify add api
use default optionsamplify push
errorExpected behavior The API service should deploy
Desktop (please complete the following information):
Additional context I have tried
amplify delete
and then the steps above and still get the issue. I've also tried manually adding the resolvers directory where it is specified, but it deletes as part of the build process and then throws the error.