Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

ProGet 2025.4 - Postgresql ApiKeyAccessLogs error when uploading packages



  • Hi, we have recently updated to ProGet version 2025.4 using Postgresql and we are getting the following error on each package upload with pgutil using either an API key or username and password:

    Unhandled exception processing https://proget.reeltimegaming.com/api/packages/rtgx-x64/upload
    
    Npgsql.PostgresException (0x80004005): 22001: value too long for type character varying(20)
       at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
       at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
       at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
       at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
       at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
       at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
       at Inedo.ProGet.Data.PostgresDatabaseContext.PostgresCommand.ExecuteReaderAsync(CancellationToken cancellationToken)
       at Inedo.Data.DatabaseContext.DbResult.CreateAsync(IGenericDbCommand command, DatabaseContext context, DateTimeOffset startTime, Stopwatch stopwatch)
       at Inedo.Data.DatabaseContext.ExecuteInternalAsync(String storedProcName, GenericDbParameter[] parameters, DatabaseCommandReturnType returnType)
       at Inedo.Data.DatabaseContext.ExecuteNonQueryAsync(String storedProcName, GenericDbParameter[] parameters)
       at Inedo.Web.Handlers.Api.ApiKeySecuredHandler.LogApiAccess(AhHttpRequest request, Byte[] responseBody, WrappedApiKey apiKey, Int32 responseCode, Boolean doNotLogRequest)
       at Inedo.Web.Handlers.Api.ApiKeySecuredHandler.ProcessRequestInternalAsync(AhHttpContext context)
       at Inedo.Web.Handlers.Api.StandardApiHandler.ProcessRequestAsync(AhHttpContext context)
      Exception data:
        Severity: ERROR
        SqlState: 22001
        MessageText: value too long for type character varying(20)
        Where: SQL statement "INSERT INTO "ApiKeyAccessLogs"
        (
            "ApiKey_Text",
            "Request_Date",
            "Request_Url",
            "Request_Method",
            "Request_Ip_Address",
            "Request_Body",
            "Response_StatusCode",
            "Response_Body"
        )
        VALUES
        (
            "@ApiKey_Text",
            "@Request_Date",
            "@Request_Url",
            "@Request_Method",
            "@Request_Ip_Address",
            "@Request_Body",
            "@Response_StatusCode",
            "@Response_Body"
        )"
    PL/pgSQL function "ApiKeys_LogRequest"(character varying,timestamp with time zone,text,character varying,character varying,integer,bytea,bytea) line 12 at SQL statement
        File: varchar.c
        Line: 640
        Routine: varchar
    
    :: Error on 18/07/2025 10:11:45 AM::
    

    The upload was done using the pgutil packages upload command. We tried both pgutil v2.1.11 and v2.1.12 using API keys as well as trying username and password.

    I have not tried uploading using a http request with credentials.

    System info:
    Web UI Version: 2025.4 (Build 6)
    Database Schema Version: 25.0.4.6
    SQL Server Version: PostgreSQL 17.5 on x86_64-windows, compiled by msvc-19.43.34808, 64-bit

    I found this other post on the forum with a linked PG issue which seems like a similar error for a different table in the Postgresql database schema.

    Thanks,
    Michael


  • inedo-engineer

    Hi @m-lee_3921 ,

    Thanks for the heads-up; we'll get this fixed via PG-3059 in the next maintenance release (scheduled for later today).

    And you're right -- its basically the same issue. SQL Server silently truncates string values whereas PostgreSQL does not, hence these errors.

    We decided to not auto-truncate, since it's better to know about these cases than not. In this case, it's a IPv6 address that was longer than the 20-character limit. We plan to refactor API key logging at some point, so we'll just continue to truncate v6 IPs.

    Thanks,
    Alana



  • Hi Alana,

    Thank you very much for your quick response and fix!

    Cheers,
    Michael


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation