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

Exception when syncing course content if file_s3_path is None #2070

Open
shanbady opened this issue Feb 24, 2025 · 0 comments
Open

Exception when syncing course content if file_s3_path is None #2070

shanbady opened this issue Feb 24, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@shanbady
Copy link
Contributor

Just noticed an exception getting thrown on production while monitoring heroku logs

Expected Behavior

Exception should not be thrown.

Current Behavior

Exception appears to get thrown when syncing course content if file_s3_path is None

2025-02-24T18:12:50.615579+00:00 app[worker.1]: [2025-02-24 18:12:50,613: ERROR/ForkPoolWorker-10] ERROR syncing course file courses/21a-348-photography-and-truth-spring-2008/resources/data.json for course courses/21a-348-photography-and-truth-spring-2008/
2025-02-24T18:12:50.615600+00:00 app[worker.1]: Traceback (most recent call last):
2025-02-24T18:12:50.615604+00:00 app[worker.1]:   File "/app/learning_resources/etl/ocw.py", line 142, in transform_content_files
2025-02-24T18:12:50.615605+00:00 app[worker.1]:     transformed_resource = transform_contentfile(
2025-02-24T18:12:50.615605+00:00 app[worker.1]:                            ^^^^^^^^^^^^^^^^^^^^^^
2025-02-24T18:12:50.615616+00:00 app[worker.1]:   File "/app/learning_resources/etl/ocw.py", line 262, in transform_contentfile
2025-02-24T18:12:50.615617+00:00 app[worker.1]:     file_extension = Path(file_s3_path).suffix
2025-02-24T18:12:50.615617+00:00 app[worker.1]:                      ^^^^^^^^^^^^^^^^^^
2025-02-24T18:12:50.615618+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.12/pathlib.py", line 1162, in __init__
2025-02-24T18:12:50.615618+00:00 app[worker.1]:     super().__init__(*args)
2025-02-24T18:12:50.615618+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.12/pathlib.py", line 373, in __init__
2025-02-24T18:12:50.615619+00:00 app[worker.1]:     raise TypeError(
2025-02-24T18:12:50.615620+00:00 app[worker.1]: TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'

Its not clear if this exception is expected/getting handled appropriately

Possible Solution

Check for empty file_s3_path argument or figure out why file_s3_path is empty if that is the root cause

@shanbady shanbady added the bug Something isn't working label Feb 24, 2025
@shanbady shanbady changed the title Exception in ETL Exception when syncing course content if file_s3_path is None Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant