Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Here is an example that is structured much the same way as my project, this follows all the standards as outlined in the documentation.
.
├── lib
│ └── shared
│ └── common.py
├── packages
│ └── my-namespace
│ ├── my-function
│ │ ├── .include
│ │ ├── __main__.py
│ │ ├── build.sh
│ │ └── requirements.txt
packages/my-namespace/my-function/.include
../../../lib/shared
__main__.py
packages/my-namespace/my-function/build.sh
#!/bin/bash
set -e
virtualenv --without-pip virtualenv
pip install -r requirements.txt --target virtualenv/lib/python3.11/site-packages --compile
packages/my-namespace/my-function/__main__.py
from shared.common import Common
def main(event, context):
return Common.foo()
packages/lib/shared/common.py
import os
class Common:
def foo(self):
return {
'statusCode': 200,
'headers': {
'Content-Type': 'application/json'
},
'body': {
'cwd': os.getcwd()
}
}
However, when calling the function it simply fails with the generic error message:
{
"code": "69c77f0d4dca6d6f2a9a79ad065f2212",
"error": "There was an error processing your request."
}
I have identified that the problem occurs when trying to import the python script that is included from lib. I have ensured: that ./shared/common.py exists within the functions directory on deployment and, that the code in ./shared/common.py is free from errors and that the scripts are executable.
If I forgoe the use of lib and instead copy shared directly into the my-function folder (effectively manually performing the include step, resulting in an identical folder structure at runtime), then the import works without issue and the code runs correctly, without any other changes required.
This defies logic and I can only conclude that there is some issue with the build process on DigitalOcean’s end that is resulting in scripts copied by the build process being inaccessible to python at runtime.
Speculatively, perhaps by way of some sort of pre-compilation/caching process rendering them as invisible/invalid to the runtime.
Whatever the cause, it renders it impossible to use lib functionality in any meaningful way.
Rory McEwan
Anjanesh Lekshminarayanan
182d09356ab94d3893ddfaca4f0270
Prashant Kumbhat
kprichard
e452769e8f30404d81a3bc803143f4
robert
Eleanor
EricWVGG