libgit2 / libgit2/libgit2sharp

AWS Lambda - Unable to load library

Offen
#1,823 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C#
Sterne
3.5k
Forks
925
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Reproduction steps

dotnet tool install -g Amazon.Lambda.Tools
dotnet new --install Amazon.Lambda.Templates
dotnet new lambda.EmptyFunction --name LambdaGit
cd LambdaGit/src/LambdaGit
dotnet add package LibGit2Sharp --version 0.27.0-preview-0034
--- add "new LibGit2Sharp.Repository();" in "FunctionHandler" function in "Function.cs"
dotnet lambda deploy-function LambdaGit --function-role LambdaGitRole
dotnet lambda invoke-function LambdaGit --payload "LambdaOK"

Actual behavior

Payload:
{
"errorType": "TypeInitializationException",
"errorMessage": "The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.",
"stackTrace": [
"at LibGit2Sharp.Core.NativeMethods.git_repository_new(git_repository*& repo)",
"at LibGit2Sharp.Core.Proxy.git_repository_new()",
"at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter)",
"at lambda_method(Closure , Stream , Stream , LambdaContextInternal )"
],
"cause": {
"errorType": "DllNotFoundException",
"errorMessage": "Unable to load shared library 'git2-ef5a385' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgit2-ef5a385: cannot open shared object file: No such file or directory",
"stackTrace": [
"at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()",
"at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary()",
"at LibGit2Sharp.Core.NativeMethods..cctor()"
]
}
}

Log Tail:
START RequestId: 0e940c07-4526-411d-9f47-ffbfc2cd3a73 Version: $LATEST
The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.: TypeInitializationException
at LibGit2Sharp.Core.NativeMethods.git_repository_new(git_repository*& repo)
at LibGit2Sharp.Core.Proxy.git_repository_new()
at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter)
at lambda_method(Closure , Stream , Stream , LambdaContextInternal )

at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary()
at LibGit2Sharp.Core.NativeMethods..cctor()

END RequestId: 0e940c07-4526-411d-9f47-ffbfc2cd3a73
REPORT RequestId: 0e940c07-4526-411d-9f47-ffbfc2cd3a73 Duration: 702.47 ms Billed Duration: 800 ms Memory Size: 256 MB Max Memory Used: 69 MB Init Duration: 156.11 ms

Version of LibGit2Sharp (release number or SHA1)

I tested all 84 available versions of GitLib2Sharp on Nuget. None of them worked.

Operating system(s) tested; .NET runtime tested

Amazon Linux 2
.NET Platform: 3.1

I analyzed several related issues in the GitLib2Sharp, aws-lambda-dotnet and Docker repositories but I was unable to solve this problem.

Please help me.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit der Reproduktion im Issue, insbesondere mit Function.cs und dessen FunctionHandler, unter Verwendung der Amazon.Lambda.Tools-Bereitstellung und des Pakets LibGit2Sharp 0.27.0-preview-0034. Verfolgen Sie den Fehler durch NativeMethods.InitializeNativeLibrary und vergleichen Sie die bereitgestellte Lambda-Umgebung mit der gemeldeten DllNotFoundException. Als abgeschlossen gilt die Aufgabe, wenn die bereitgestellte Funktion LibGit2Sharp.Repository instanziieren und erfolgreich aufrufen kann, ohne dass der Fehler der nativen Bibliothek auftritt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
aws, csharp
Bereich
backend, cloud
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.