Unable to Upload GCode Files - Solved

I have a fresh install of Octopi on a Raspberry Pi 3B+ with an attached USB drive. I setup the Pi to auto mount the USB drive by updating fstab with the following:

PARTUUID=dd08d5ae-01 /home/pi/data ntfs-3g defaults,auto,rw,nofail,umask=000 0 0

I then setup a Samba share for the data folder and pointed the Upload, Timelapse, Timelapse Temp, and Watched folders in Octoprint to the mounted data drive. Octoprint can see the folders when I test them. However, when I try to upload gcode files, I get the following error:

Upload failed

Could not upload the file. Make sure that it is a readable, valid file with one of these extensions: .bmp, .bmp, .g, .gco, .gcode, .gif, .gif, .jpeg, .jpeg, .jpg, .jpg, .png, .png, .webp, .webp

{"error":"The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application."}

I had this setup running before, but re-flashed the Pi to update to Python 3. Also I am able to upload files directly to the Samba share. But if I load those files onto the printer in Octoprint I get an error message but it still lets me print them.

If I reset the upload folder to the default location, it works fine.

Also found these entries in the log file:

File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/init.py", line 1018, in atomic_write
os.chmod(fd.name, permissions)
PermissionError: [Errno 1] Operation not permitted: '/home/pi/data/uploads/AM4_Backplate/tmp_3nyp5p7'
octoprint-systeminfo-20211123195721.zip (45.1 KB)

After doing some digging on the permissions, I found the USB drive was being mounted under Root and the pi user only had read access. I added uid=1000 to the entry in fstab to mount the drive under the pi user and it started working as intended.