Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting permission denied in lambda deployment #443

Closed
Sabreen-Parveen opened this issue Nov 10, 2023 · 2 comments
Closed

Getting permission denied in lambda deployment #443

Sabreen-Parveen opened this issue Nov 10, 2023 · 2 comments
Labels

Comments

@Sabreen-Parveen
Copy link

I have deployed codium agent using a lambda function using this guide.
Branch used: main
I am getting this errror:

[ERROR] OSError: [Errno 30] Read-only file system: '/home/sbx_user1051'
Traceback (most recent call last):
  File "/var/lang/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/var/task/pr_agent/servers/serverless.py", line 7, in <module>
    from pr_agent.servers.github_app import router
  File "/var/task/pr_agent/servers/github_app.py", line 12, in <module>
    from pr_agent.agent.pr_agent import PRAgent
  File "/var/task/pr_agent/agent/pr_agent.py", line 5, in <module>
    from pr_agent.git_providers.utils import apply_repo_settings
  File "/var/task/pr_agent/git_providers/__init__.py", line 7, in <module>
    from pr_agent.git_providers.azuredevops_provider import AzureDevopsProvider
  File "/var/task/pr_agent/git_providers/azuredevops_provider.py", line 12, in <module>
    from azure.devops.connection import Connection
  File "/var/lang/lib/python3.10/site-packages/azure/devops/connection.py", line 9, in <module>
    from ._file_cache import RESOURCE_CACHE as RESOURCE_FILE_CACHE
  File "/var/lang/lib/python3.10/site-packages/azure/devops/_file_cache.py", line 128, in <module>
    DEFAULT_CACHE_DIR = get_cache_dir()
  File "/var/lang/lib/python3.10/site-packages/azure/devops/_file_cache.py", line 118, in get_cache_dir
    os.makedirs(azure_devops_cache_dir)
  File "/var/lang/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/var/lang/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/var/lang/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/var/lang/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)

Please help me in resolving this issue.

@barnett-yuxiang
Copy link
Contributor

The error you are encountering, [Errno 30] Read-only file system, suggests that your application is trying to write to a file system location (/home/sbx_user1051) which is read-only. This can occur in environments like AWS Lambda where the file system is not writable except for the /tmp directory.

Here are some steps to resolve this issue:

  1. Modify Cache Directory Location: The error seems to originate from the Azure DevOps Python SDK trying to create a cache directory. You should modify the cache directory location to a writable path, like /tmp in AWS Lambda environments. You can often set this through environment variables or SDK configuration options.

  2. Review Permissions: Ensure that the user under which the application is running has the necessary permissions to write to the desired directory. In serverless environments, you're typically limited to specific directories (like /tmp in AWS Lambda).

  3. Update SDK/Library Usage: If you are using an SDK or library that does not support changing the cache directory, consider updating it to a newer version that might have this feature. Alternatively, you might need to look for workarounds or modify the library, if possible.

  4. Environment Configuration: Review your environment configuration to ensure it's set up correctly for writable directories. In serverless and containerized environments, file system access can be limited, so understanding these limitations is crucial.

  5. Logging and Debugging: Add additional logging around the file operations to get more insights into the failure. This can help in identifying if there are other underlying issues.

  6. Code Review: Review your code to ensure you are not unintentionally trying to write to a read-only part of the file system. In some cases, file paths might be hardcoded or incorrectly configured.

  7. Consult Documentation: Review the documentation for the environment you are deploying to (e.g., AWS Lambda) and any SDKs or libraries you are using to understand their file system limitations and configurations.

By addressing these areas, you should be able to identify and fix the root cause of the Read-only file system error.

@mrT23
Copy link
Collaborator

mrT23 commented Dec 17, 2023

@Sabreen-Parveen
does the issue still exist, or can I close it ?

@mrT23 mrT23 added the solved label Dec 17, 2023
@mrT23 mrT23 closed this as completed Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants