Skip to content

Serverless 3, Fastapi 0.104+ and Layers! Error: typing-extension #12324

Answered by rickythefox
Verde1705 asked this question in Q&A
Discussion options

You must be logged in to vote

Just spent a few frustrating hours trying to fix this...

Here is a python script that you can run in your CI after deploy to move the sls layer to the first place and thus prevent it from overwriting typing-extensions with an older version. Make sure to pip install boto3 first.

#!/usr/bin/env python3

import sys
import boto3

def reorder_layers(lambda_name):
    # Initialize a Boto3 client for Lambda
    lambda_client = boto3.client('lambda')

    # Get the current configuration of the Lambda function, particularly the Layers
    response = lambda_client.get_function_configuration(FunctionName=lambda_name)
    layers = response.get('Layers', [])

    # Separate the desired layer from others

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Verde1705
Comment options

Answer selected by Verde1705
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants