Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

302
Vistas
Why Does EPPlus Excel Library in AWS Lambda Environment Throw "The type initializer for 'Gdip' threw an exception"

Posting this question for others experiencing the same issue. My answer below.

I created an AWS Lambda method that receives a series of query parameters that are used to produce a report. The report data is saved in an Excel file using the excellent EPPlus library. When I run the code in the development environment it executes without a problem. After I deploy the code to AWS and call it via the URL I get the following exception:

The type initializer for 'Gdip' threw an exception

Why would this happen after deployment, yet run properly in the development environment?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

What I was able to determine is that the error occurs when attempting to automatically size column widths to fit the supplied data in one of the worksheets. EPPlus helpfully supplies an AutoFitColumns method for a range that will size the columns based on the widest data in the range. Once I pinpointed this line of code as the source of the exception it all made sense.

I have not confirmed this, but I assume that EPPlus loops through the text in each cell of the range and calls the .Net Graphics.MeasureString method from the System.Drawing namespace to determine the width of the rendered text. Once the widest string is determined the column width is set accordingly.

The problem is that it appears that the GDI+ API is not available in the AWS lambda environment. I believe you can add libgdiplus to your AWS Lambda environment (see forum discussions here and here). However, I did not attempt to change my configuration, instead opting for default column widths with word wrap enabled.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda