grok2api
grok2api copied to clipboard
bug: vercel部署失败
问题描述
复现步骤
could not import "app/main.py":
Traceback (most recent call last):
File "/var/task/_vendor/vercel_runtime/vc_init.py", line 474, in
File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/var/task/app/main.py", line 88, in <module>
setup_logging(
~~~~~~~~~~~~~^
level=os.getenv("LOG_LEVEL", "INFO"),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
file_logging=os.getenv("LOG_FILE_ENABLED", "true").strip().lower()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in {"1", "true", "yes", "on"},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/var/task/app/platform/logging/logger.py", line 68, in setup_logging
_add_file_sink(
~~~~~~~~~~~~~~^
file_level=(file_level or resolved_level).upper(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
max_files=max_files,
^^^^^^^^^^^^^^^^^^^^
log_dir=log_dir,
^^^^^^^^^^^^^^^^
)
^
File "/var/task/app/platform/logging/logger.py", line 137, in _add_file_sink
_dir.mkdir(parents=True, exist_ok=True)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.13/pathlib/_local.py", line 722, in mkdir
os.mkdir(self, mode)
~~~~~~~~^^^^^^^^^^^^
OSError: [Errno 30] Read-only file system: '/var/task/logs'
could not import "app/main.py":
Traceback (most recent call last):
File "/var/task/_vendor/vercel_runtime/vc_init.py", line 474, in <module>
__vc_module = import_module(_entrypoint_modname, _entrypoint_abs)
File "/var/task/_vendor/vercel_runtime/resolver.py", line 24, in import_module
spec.loader.exec_module(mod)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^
File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/var/task/app/main.py", line 88, in <module>
setup_logging(
~~~~~~~~~~~~~^
level=os.getenv("LOG_LEVEL", "INFO"),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
file_logging=os.getenv("LOG_FILE_ENABLED", "true").strip().lower()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in {"1", "true", "yes", "on"},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/var/task/app/platform/logging/logger.py", line 68, in setup_logging
_add_file_sink(
~~~~~~~~~~~~~~^
file_level=(file_level or resolved_level).upper(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
max_files=max_files,
^^^^^^^^^^^^^^^^^^^^
log_dir=log_dir,
^^^^^^^^^^^^^^^^
)
^
File "/var/task/app/platform/logging/logger.py", line 137, in _add_file_sink
_dir.mkdir(parents=True, exist_ok=True)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.13/pathlib/_local.py", line 722, in mkdir
os.mkdir(self, mode)
~~~~~~~~^^^^^^^^^^^^
OSError: [Errno 30] Read-only file system: '/var/task/logs'
Python process exited with exit status: 1. The logs above can help with debugging the issue.
### 版本
main
### 相关日志
```shell
could not import "app/main.py":
Traceback (most recent call last):
File "/var/task/_vendor/vercel_runtime/vc_init.py", line 474, in <module>
__vc_module = import_module(_entrypoint_modname, _entrypoint_abs)
File "/var/task/_vendor/vercel_runtime/resolver.py", line 24, in import_module
spec.loader.exec_module(mod)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^
File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/var/task/app/main.py", line 88, in <module>
setup_logging(
~~~~~~~~~~~~~^
level=os.getenv("LOG_LEVEL", "INFO"),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
file_logging=os.getenv("LOG_FILE_ENABLED", "true").strip().lower()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in {"1", "true", "yes", "on"},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/var/task/app/platform/logging/logger.py", line 68, in setup_logging
_add_file_sink(
~~~~~~~~~~~~~~^
file_level=(file_level or resolved_level).upper(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
max_files=max_files,
^^^^^^^^^^^^^^^^^^^^
log_dir=log_dir,
^^^^^^^^^^^^^^^^
)
^
File "/var/task/app/platform/logging/logger.py", line 137, in _add_file_sink
_dir.mkdir(parents=True, exist_ok=True)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.13/pathlib/_local.py", line 722, in mkdir
os.mkdir(self, mode)
~~~~~~~~^^^^^^^^^^^^
OSError: [Errno 30] Read-only file system: '/var/task/logs'
could not import "app/main.py":
Traceback (most recent call last):
File "/var/task/_vendor/vercel_runtime/vc_init.py", line 474, in <module>
__vc_module = import_module(_entrypoint_modname, _entrypoint_abs)
File "/var/task/_vendor/vercel_runtime/resolver.py", line 24, in import_module
spec.loader.exec_module(mod)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^
File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/var/task/app/main.py", line 88, in <module>
setup_logging(
~~~~~~~~~~~~~^
level=os.getenv("LOG_LEVEL", "INFO"),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
file_logging=os.getenv("LOG_FILE_ENABLED", "true").strip().lower()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in {"1", "true", "yes", "on"},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/var/task/app/platform/logging/logger.py", line 68, in setup_logging
_add_file_sink(
~~~~~~~~~~~~~~^
file_level=(file_level or resolved_level).upper(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
max_files=max_files,
^^^^^^^^^^^^^^^^^^^^
log_dir=log_dir,
^^^^^^^^^^^^^^^^
)
^
File "/var/task/app/platform/logging/logger.py", line 137, in _add_file_sink
_dir.mkdir(parents=True, exist_ok=True)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.13/pathlib/_local.py", line 722, in mkdir
os.mkdir(self, mode)
~~~~~~~~^^^^^^^^^^^^
OSError: [Errno 30] Read-only file system: '/var/task/logs'
Python process exited with exit status: 1. The logs above can help with debugging the issue.
```
试着将环境变量DATA_DIR修改为/tmp/data LOG_FILE_ENABLED修改为false