Python function cannot find included dependency

Here is my serverless.yml file:

org: jmgilman
app: fapi
service: fapi
frameworkVersion: '2 || 3'

  name: aws
  runtime: python3.8
  lambdaHashingVersion: '20201221'
  region: us-west-2
    handler: balance.main
      - httpApi:
          path: /
          method: get
  - serverless-python-requirements
    slim: true
    layer: true
    dockerizePip: true

My dependencies are handled by Poetry:

name = "fapi"
version = "0.1.0"
description = ""

python = "^3.8"
beancount = "^2.3.4"
boto3 = "^1.20.30"

black = "^21.12b0"

requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

The top of my file:

import boto3
import json
import os

from beancount import loader
from beancount.core import realization
from pathlib import Path

When I run the function I get the following error:

[ERROR] ModuleNotFoundError: No module named 'beancount'

The deploy process seems to be working as expected with the serverless-python-requirements plugin doing the necessary work to package the dependencies with the function.

$ serverless deploy
Serverless: Running "serverless" installed locally (in service node_modules)
Serverless: Generating requirements.txt from pyproject.toml...
Serverless: Parsed requirements.txt from pyproject.toml in /Users/josh/code/fapi/.serverless/requirements.txt...
Serverless: Using static cache of requirements found at /Users/josh/Library/Caches/serverless-python-requirements/7b6085c32db879837c55e163f2b383174b0a9de7d5bc0af9a340bbc9c8f23fc9_x86_64_slspyc ...
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Packaging Python Requirements Lambda Layer...
Serverless: Ensuring that deployment bucket exists
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service file to S3 (51.38 MB)...
Serverless: Uploading service file to S3 (34 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
Serverless: Stack update finished...

I’ve looked at a dozen or so tutorials and SO answers and nothing is sticking out that I’ve done wrong here. Any idea why the function can’t find the beancount dependency ?

Figured out the issue after more digging and it seems like a bug with Serverless. Basically, when serverless attempted to attach the layer created by the plugin to the function it failed because it was exceeding the max size of 250MB. This failure was silent in the deployment process though and I only figured it out after seeing the function had no assigned layer and attempting to manually assign the layer resulted in the above error.