I have an container-based AWS Lambda that reads from S3 and writes to Dropbox. It has worked for months and it quit working on Saturday (2023-11-17) morning.
Given two folders and paths
- My Team/folder01/folder02
- Some User # person that created the token
using python, when I call
files_upload(b'data', 'My Team/folder01/folder02/filename.txt')
to write a file:
1. it used to write the file: `My Team/folder01/folder02/filename.txt`
2. now it writes the file: `Some User/My Team/folder01/folder02/filename.txt`
After much reading, I have discovered that I need to set the path root for the "team" rather than the "member" or user.
I am now doing that with the following two lines:
root_namespace_id = dbx.users_get_current_account().root_info.root_namespace_id
dbx = dbx.with_path_root(dropbox.common.PathRoot.root(root_namespace_id))
this works great locally on my development computer, but when I add the two lines to my AWS Lambda logic, it appears to be ignored when I execute it remotely.
Given the following four lines:
dbx = DropboxTeam(DROPBOX_ACCESS_TOKEN).as_user(DROPBOX_TEAM_USER)
root_namespace_id = dbx.users_get_current_account().root_info.root_namespace_id
dbx = dbx.with_path_root(dropbox.common.PathRoot.root(root_namespace_id))
metadata = dbx.files_upload(b'data', 'My Team/folder01/folder02/filename.txt')
If I execute those four lines on my local computer the files write to the expected (team) folder
My Team/folder01/folder02/filename.txt
If my AWS Lambda executes those four lines, it writes to the user/member folder
Some User/My Team/folder01/folder02/filename.txt
I have logged out the
it is the same, both locally and remotely
The only thing I see in the metadata is that
Locally:
- parent_shared_folder_id='12345678'
- sharing_info=FileSharingInfo(modified_by=...)
Remotely:
- parent_shared_folder_id=NOT_SET
- sharing_info=NOT_SET
Do I need to do something special when making this call in an AWS Lambda?