aws / aws/chalice

Issue with S3 ObjectCreated event with calling Database

Open
#1,899 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

I have all the configuration for the DB call in the UTIL python file.
S3 object creation is firing properly when file is uploaded to S3, I am also able to parse the file to get the file, all the hell goes lose when I try to insert the parsed record in the database.
Insert method works standalone but it doesn't work when called thru S3 objectcreated event.
i get the following error:

partially initialized module 'chalicelib.award_upload' has no attribute 'award_upload' (most likely due to a circular import)Traceback (most recent call last):  File "/var/lang/lib/python3.8/imp.py", line 234, in load_module    return load_source(name, filename, file)  File "/var/lang/lib/python3.8/imp.py", line 171, in load_source    module = _load(spec)  File "", line 702, in _load  File "", line 671, in _load_unlocked  File "", line 843, in exec_module  File "", line 219, in _call_with_frames_removed  File "/var/task/chalicelib/award_upload.py", line 1, in     from chalicelib import rei_utils  File "/var/task/chalicelib/rei_utils.py", line 1, in     import app  File "/var/task/app.py", line 31, in     app.register_blueprint(award_upload.award_upload) | [ERROR] AttributeError: partially initialized module 'chalicelib.award_upload' has no attribute 'award_upload' (most likely due to a circular import) Traceback (most recent call last):   File "/var/lang/lib/python3.8/imp.py", line 234, in load_module     return load_source(name, filename, file)   File "/var/lang/lib/python3.8/imp.py", line 171, in load_source     module = _load(spec)   File "", line 702, in _load   File "", line 671, in _load_unlocked   File "", line 843, in exec_module   File "", line 219, in _call_with_frames_removed   File "/var/task/chalicelib/award_upload.py", line 1, in     from chalicelib import rei_utils   File "/var/task/chalicelib/rei_utils.py", line 1, in     import app   File "/var/task/app.py", line 31, in     app.register_blueprint(award_upload.award_upload)
-- | --

Contributor guide

Open the contributing guide

Research direction

Start by tracing the import chain shown in chalicelib/award_upload.py, chalicelib/rei_utils.py, and app.py, then reproduce the S3 ObjectCreated invocation with the database call. Compare this event path with the standalone insert path; done means the deployed handler loads without the circular-import error and can insert the parsed record.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.