Open
Description
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