Skip to content

Commit

Permalink
dev-520: add sentry and bump python version to 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
uptickmetachu committed Dec 13, 2023
1 parent 1401af8 commit e68276d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ fonts.zip
license.dat
# Layer working directory
python/
fonts
fonts/*
fonts/
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# docker build --platform linux/amd64 -t ${IMAGE} --target=base .
FROM public.ecr.aws/lambda/python:3.9-x86_64
FROM public.ecr.aws/lambda/python:3.11-x86_64
ENV PRINCE_FILENAME=prince-14.1-linux-generic-x86_64
RUN yum clean all \
&& yum install -y unzip giflib \
Expand All @@ -11,8 +11,8 @@ RUN yum clean all \
COPY lambda_requirements.txt fonts.zip* ./
RUN pip3 install -r lambda_requirements.txt
# Fonts zip may not exist, so || true it.
RUN unzip -o fonts.zip || true
RUN rm -f fonts.zip*
CMD rm -rf /var/task/fonts || true
COPY fonts /var/task/fonts
COPY license.dat ./prince-engine/license/license.dat
COPY lambda_function.py ./
CMD ["lambda_function.lambda_handler"]
10 changes: 9 additions & 1 deletion lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@
import sys
import traceback
import xml.etree.ElementTree as ET
from itertools import chain
from urllib.parse import urlparse
from uuid import uuid4

import boto3
import requests
import sentry_sdk
from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration

S3_RETRY_COUNT = 10

sentry_sdk.init(
dsn=os.environ.get("SENTRY_DSN", ""),
integrations=[
AwsLambdaIntegration(),
],
)


def init():
# If there's any files in the font directory, export FONTCONFIG_PATH
Expand Down
5 changes: 3 additions & 2 deletions lambda_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
requests==2.22.0
boto3==1.21.17
requests==2.31.0
boto3==1.34.0
sentry-sdk==1.39.0

0 comments on commit e68276d

Please sign in to comment.