Describe the bug
After adding api via amplify add api, then trying to push changes to cloud using amplify push, I receive following error at the time of adding resources to local folder
✖ An error occurred when pushing the resources to the cloud
EROFS: read-only file system, mkdir '/graphql'
An error occurred during the push operation: EROFS: read-only file system, mkdir '/graphql'
I am on Mac. My previous CLI version was worked perfectly fine. Latest version giving this problem.
I am doing this under fresh React Native CLI project.
Amplify CLI Version
4.29.4
To Reproduce
Steps to reproduce the behavior or terminal output if applicable
Expected behavior
Screenshots
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
can you ls -l
from a glance it looks like the user does not have permissions to create the /graphql
directory
I am having the exact same issue, it seems to be an issue related to the root directory on mac being read-only, but the push is failing because the directory can't be created
Seems like a folder permission issue locally and not directly tied to the amplify cli. Try using sudo with the amplify command if you're still facing this issue.
Seems like a folder permission issue locally and not directly tied to the amplify cli. Try using sudo with the amplify command if you're still facing this issue.
You shouldn't need to run this with sudo. Why is the command trying to write to the root directory? Where is this specified? Seems to me like the CLI default of "/" is incorrect.
Which command are you trying to run @testflyjets? The CLI doesn't alter any files in / but it does store the AWS tokens in your ~/.aws folder and generates artifacts from where you're trying to run the CLI command.
The amplify init
call seems to use /
as a path -- could this be the issue?
@testflyjets This is the root or '/' path relative to your project-path not the system root.
Okay, but this still doesn't explain why the tool is trying to write to /graphql
-- are you saying that path is a relative local path to the project? If the previous version of the CLI didn't require sudo to complete this action then this would seem to be a reversion, and this issue shouldn't be closed.
I'm also having the same problem with amplify-cli 4.29.4. Sudo-ing amplify push doesn't solve the issue
What permission are set on your root folder it would help me debug the problem?
Permissions on the root folder are drwxr-xr-x
May or may not be relevant, but I amplify init
this project today after upgrading to the latest cli version
May or may not be relevant, but I amplify init this project today after upgrading to the latest cli version
Version 4.29.4?
May or may not be relevant, but I amplify init this project today after upgrading to the latest cli version
Version 4.29.4?
Yep
@WillTinney I could reproduce it with npx react-native? @testflyjets are you using npx too?
Yes, I was using npx react-native.
same issue
I've set 777 permission on graphql folder... the script don't return error but the folder is empty
I encountered the same issue, I think it came from the file .grzphqlconfig.yml . the path shown in the schemepath wasnt right, when I changed it the issue was fixed
Hi, where is this file?
exactly same issue on amplify version 4.29.4
I retried the amplify push
command and changed the two paths that default to /
to ./
and the command completed successfully. I am on Mac OS 10.15.7, FWIW.
@testflyjets This worked for me! Thanks!!
Until version 4.29.3, amplify-codegen
was hard coded to generate output in src
directory.
In version 4.29.4, amplify-codegen
generates output in SourceDir
.
So you should change javascript.config.SourceDir
to "src"
(your source dir) in amplify/.config/project-config.json
, remove .graphqlconfig.yml
, and run $amplify codegen add
$amplify init
.
Following the comment from @Injae-Lee comment, I changed SourceDir inside of the project-config.json to "./" and ran amplify codegen which worked for me.
I retried the
amplify push
command and changed the two paths that default to/
to./
and the command completed successfully. I am on Mac OS 10.15.7, FWIW.
Super.. this worked for me. I am using CLI 4.29.6
same^
I can reproduce with CLI 4.30.0. The solutions above work great!
Opened aws-amplify/docs#2581 and aws-amplify/amplify-cli#5654 to correct the React native getting started guide.
Change to ./
didnt worked for me.
amplify codegen
also failed because of EROFS: read-only file system, mkdir '/graphql'
Funny but my solution was to mock first.
amplify mock api
amplify push
https://docs.amplify.aws/start/getting-started/data-model/q/integration/react-native#deploying-the-api
(Optional) Test your API
To test this out locally, you can run the mock command.
If you’d like to go ahead and deploy the API, you can jump to the next step.
@Finneah
/
to ./
in amplify/.config/project-config.json
.graphqlconfig.yml
amplify codegen add
amplify push
Alternatively, start fresh and use ./
as both directory paths
I think the file in step 2 is cached so you have to remove that too.
@Finneah
- Change
/
to./
inamplify/.config/project-config.json
- Remove
.graphqlconfig.yml
- Run
amplify codegen add
- Run
amplify push
Alternatively, start fresh and use./
as both directory pathsI think the file in step 2 is cached so you have to remove that too.
@wei
I tried both. But without step 2. Change the dir and make a fresh start with changed dir didn’t worked. But with Step 2 it’s a good idea. I give it a try next time 👍
I retried the
amplify push
command and changed the two paths that default to/
to./
and the command completed successfully. I am on Mac OS 10.15.7, FWIW.
Thank you very much @testflyjets !!!
Docs (LIVE) updated in aws-amplify/docs#2581.
CLI update is pending in #5654.
In my case in the .graphqlconfig.yml
the schemaPath:
property was somehow set to /../../../../../../schema.graphql
when it was auto generated. My fix was to update the path to amplify/backend/api/<api name>/build/schema.graphql
The following solved the issue for me.
amplify mock api
to create .graphqlconfig.yml
Then edit the schema path from ../../../../graphql/schema.json
to ./amplify/backend/api/YUOR_PROJECT_NAME/build/schema.json
Problem:
I was working on https://github.com/aws-samples/aws-amplify-react-native-events-app-workshop/ with same issue:
EACCES: permission denied, mkdir '/graphql'
An error occurred during the push operation: EACCES: permission denied, mkdir '/graphql'
To resolve:
Verify:
amplify push (completed without errors)
Solved the error after realizing I forgot to add 'read' operation to the new type model I created before pushing. check on schema.graphql
file:
` operations: [create, update, delete, read]. <-- here`
This worked for me as well:
Problem:
I was working on https://github.com/aws-samples/aws-amplify-react-native-events-app-workshop/ with same issue:
EACCES: permission denied, mkdir '/graphql'
An error occurred during the push operation: EACCES: permission denied, mkdir '/graphql'
To resolve:
rename /code/.graphqlconfig.yml to .bak and then delete (will be recreated with amplify push)
updated path "/" to "./" in amplify/.config/project-config.json
Verify:
amplify push (completed without errors)
Problem:
I was working on https://github.com/aws-samples/aws-amplify-react-native-events-app-workshop/ with same issue:EACCES: permission denied, mkdir '/graphql'
An error occurred during the push operation: EACCES: permission denied, mkdir '/graphql'To resolve:
- rename /code/.graphqlconfig.yml to .bak and then delete (will be recreated with amplify push)
- updated path "/" to "./" in amplify/.config/project-config.json
Verify:
amplify push (completed without errors)
This worked for me!
I retried the
amplify push
command and changed the two paths that default to/
to./
and the command completed successfully. I am on Mac OS 10.15.7, FWIW.
I tried the amplify push
✖ An error occurred when pushing the resources to the cloud
EROFS: read-only file system, mkdir '/graphql'
An error occurred during the push operation: EROFS: read-only file system, mkdir '/graphql'
Am using Expo and NPM
I saw yours did pass the amplify push can you help me and when you changed can you reference me the new path you puted?
Thanks it resolved
with
Problem:
I was working on https://github.com/aws-samples/aws-amplify-react-native-events-app-workshop/ with same issue:
EACCES: permission denied, mkdir '/graphql'
An error occurred during the push operation: EACCES: permission denied, mkdir '/graphql'
To resolve:
rename /code/.graphqlconfig.yml to .bak and then delete (will be recreated with amplify push)
updated path "/" to "./" in amplify/.config/project-config.json
Verify:
amplify push (completed without errors)
Most helpful comment
I retried the
amplify push
command and changed the two paths that default to/
to./
and the command completed successfully. I am on Mac OS 10.15.7, FWIW.