Skip to content

AWS CodeBuild SSL Connection Errors to NuGet and CodeArtifact

1

On two different AWS-managed CodeBuild servers (Windows Sever 2019 with latest Image, as well as Amazon Linux using aws/codebuild/amazonlinux-x86_64-standard:5.0), we are seeing errors in retrieving packages from either CodeArtifact or nuget.org.

The logs both point to error NU1101: Unable to find package (No packages exist with this id in source(s): codeartifact, nuget.org).

Some of these packages are commonly used, including, but not limited to:

Microsoft.AspNetCore.Components.Authorization Microsoft.Extensions.Options AWSSDK.SSOOIDC

Also in the log: The SSL connection could not be established, see inner exception. The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

Is anyone else experiencing this issue? The problems did not exist for us last week, and the problem occurs from both new builds as well as old builds.

asked a year ago389 views

3 Answers
2
Accepted Answer

Issue is on the nuget side. You can check their status page

https://status.nuget.org/

answered a year ago

  • Thank you! I checked their status page at the time of my post and there were no issues reported either there, or on the AWS page. I'll wait until their status page gives the all clear, then I'll try another build. If the build succeeds after their issue is resolved. I'll accept your answer.

1

The issue you're experiencing with SSL connection errors in AWS CodeBuild when trying to retrieve packages from CodeArtifact or nuget.org is not uncommon and can occur due to various reasons. The error messages you're seeing, particularly the SSL connection failure and the remote certificate validation error, suggest there might be an issue with the SSL/TLS handshake between CodeBuild and the package repositories.

Given that this problem started occurring recently and affects both Windows Server 2019 and Amazon Linux environments, it's possible that there's been a change in the CodeBuild environment or the package repositories' SSL certificates.

Here are a few steps you can try to resolve this issue:

  1. Ensure that your CodeBuild project's IAM role has the necessary permissions to access CodeArtifact. The role should have permissions for actions like "codeartifact:GetAuthorizationToken", "codeartifact:GetRepositoryEndpoint", and "codeartifact:ReadFromRepository".

  2. If you're using CodeArtifact, make sure you're using the CodeArtifact Credential Provider in your buildspec.yaml file. This should be configured in the pre_build section to allow NuGet CLI tool commands to run correctly.

  3. Check if there have been any recent changes to your project's buildspec or NuGet configuration that might affect package resolution.

  4. Try clearing the NuGet cache as part of your build process. You can do this by adding a command like "nuget locals all -clear" to your buildspec.

  5. Ensure that your CodeBuild project is using the latest version of NuGet. CodeArtifact supports NuGet 4.8 and higher, so using an older version could cause issues.

  6. If the problem persists, you may need to contact AWS support to check if there are any known issues with CodeBuild or CodeArtifact that could be causing this problem.

Remember, SSL/TLS issues can sometimes be transient, so if the problem doesn't occur consistently, it might resolve itself. However, if it continues, these steps should help you troubleshoot and potentially resolve the issue.
Sources
NuGet compatibility - CodeArtifact
Using NuGet packages in CodeBuild - CodeArtifact

answered a year ago

EXPERT

reviewed a year ago

1

we're experiencing the same issue throughout the day today. thinking it was a Zscaler certificate issue initially.

logs from our codebuild project included below.

2025-05-13T15:21:38.742Z Determining projects to restore...

Determining projects to restore... 2025-05-13T15:21:40.754Z Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/mailkit/index.json'.

Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/mailkit/index.json'. 2025-05-13T15:21:40.754Z The SSL connection could not be established, see inner exception.

The SSL connection could not be established, see inner exception. 2025-05-13T15:21:40.754Z The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.