├── README.md
├── ai
│ ├── __init__.py
│ ├── news_insights
│ │ ├── __init__.py
│ │ ├── config.py
│ │ ├── handler.py
│ │ ├── insights_generator.py
│ │ ├── news_retriever.py
│ │ ├── requirements.txt
│ │ └── utils.py
│ └── openai_completion
│ └── handler.py
├── hello
│ ├── handler.py
│ └── requirements.txt
├── linkedin
│ ├── apollo_get_url
│ │ └── handler.py
│ ├── clearbit_get_url
│ │ └── handler.py
│ ├── get_company_url
│ │ └── handler.py
│ ├── get_lead
│ │ └── handler.py
│ └── reverse_contact_get_url
│ └── handler.py
├── package-lock.json
├── package.json
├── poetry.lock
├── pyproject.toml
└── serverless.yml
With this file structure I’m getting module not found on the news_insights function
{
"errorMessage": "Unable to import module 'ai/news_insights/handler': No module named 'ai'",
"errorType": "Runtime.ImportModuleError",
"requestId": "b682f388-a533-4d5b-bb61-4dd806535700",
"stackTrace": []
}
This is my serverless.yml
service: enrichment-modules
frameworkVersion: "3"
org: calbornozscalestack
app: enrichment-modules
provider:
name: aws
runtime: python3.11
region: "us-east-1"
package:
individually: true
patterns:
- "!./**"
functions:
apolloGetUrl:
handler: linkedin/apollo_get_url/handler.lambda_handler
package:
patterns:
- linkedin/apollo_get_url/*
events:
- http:
path: linkedin/apollo/get-url
method: get
environment:
APOLLO_API_KEY: ${param:apollo_api_key}
clearbitGetUrl:
handler: linkedin/clearbit_get_url/handler.lambda_handler
package:
patterns:
- linkedin/clearbit_get_url/*
events:
- http:
path: linkedin/clearbit/get-url
method: get
environment:
CLEARBIT_API_KEY: ${param:clearbit_api_key}
getCompanyUrl:
handler: linkedin/get_company_url/handler.lambda_handler
package:
patterns:
- linkedin/get_company_url/*
events:
- http:
path: linkedin/get-company-url
method: get
getLead:
handler: linkedin/get_lead/handler.lambda_handler
package:
patterns:
- linkedin/get_lead/*
events:
- http:
path: linkedin/get-lead
method: get
reverseContactGetUrl:
handler: linkedin/reverse_contact_get_url/handler.lambda_handler
package:
patterns:
- linkedin/reverse_contact_get_url/*
events:
- http:
path: linkedin/reverse-contact/get-url
method: get
environment:
REVERSE_CONTACT_API_KEY: ${param:reverse_contact_api_key}
openaiCompletion:
handler: ai/openai_completion/handler.lambda_handler
package:
patterns:
- ai/openai_completion/*
events:
- http:
path: ai/openai/completion
method: get
environment:
OPENAI_API_KEY: ${param:openai_api_key}
newsInsights:
handler: ai/news_insights/handler.lambda_handler
module: ai/news_insights
package:
patterns:
- ai/news_insights/*
events:
- http:
path: ai/news-insights
method: get
environment:
OPENAI_API_KEY: ${param:openai_api_key}
BING_API_KEY: ${param:bing_api_key}
APOLLO_API_KEY: ${param:apollo_api_key}
SCLAESTACK_API_KEY: ${param:scalestack_api_key}
RAPIDAPI_API_KEY: ${param:rapidapi_api_key}
hello:
module: hello
handler: hello/handler.handler
package:
patterns:
- hello/*
events:
- http:
path: hello
method: get
custom:
pythonRequirements:
dockerizePip: true
plugins:
- serverless-python-requirements
All other functions seem to work properly, just that one is giving me problem. Any idea on what it could be?
If there is more information I can provide, happy to help and thanks in advance.