API calls failing with (The request signature we calculated does not match the signature you provided. Check your key and signing method.)

Hello,

I’m running groupdocs in our custom infrastructure as well as with docker in the local environment.

On the cloud infra I’m using AWS AppRunner to execute the docker container I stored on ECR.

On the local environment as well as on AWS every time I call an API I get the following payload:

{
  "uploaded": [],
  "errors": [
    {
      "code": "error",
      "message": "One or more errors occurred. (The request signature we calculated does not match the signature you provided. Check your key and signing method.)",
      "description": "Operation Failed. General Error.",
      "innerError": {
        "requestId": null,
        "date": "2023-06-01T17:39:28.2019269+00:00"
      }
    }
  ]
}

The logs didn’t find that much information and I didn’t find a way to configure them to be more verbose.

The only message I saw on the logs are:

2023-06-01 14:51:50 info: GroupDocs.Conversion.Cloud.Web.Startup[0]
2023-06-01 14:51:50       The license has been set.
2023-06-01 14:51:52 warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
2023-06-01 14:51:52       Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
2023-06-01 14:51:52 warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
2023-06-01 14:51:52       No XML encryptor configured. Key {041a4e05-ac6c-4047-bb09-243e9f0edc1c} may be persisted to storage in unencrypted form.
2023-06-01 14:51:52 Hosting environment: Production
2023-06-01 14:51:52 Content root path: /app
2023-06-01 14:51:52 Now listening on: http://[::]:80
2023-06-01 14:51:52 Application started. Press Ctrl+C to shut down.

Thanks,
Julio

@juliosarachaga

The API throws this exception when it cannot find the referenced file. Please double check the file path and availability; it will resolve the issue.

Hi @tilal.ahmad

I’m actually uploading the file using swagger.
I understand it makes sense the file doesn’t exists. I attach the curl request that I get from swagger

curl -X 'PUT' \
  'https://server.us-east-1.awsapprunner.com/v2.0/conversion/storage/file/%2Ffloorplan.pdf?storageName=files-demo-development' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer <TOKEN>' \
  -H 'Content-Type: multipart/form-data' \
  -F 'File=@floorplan.pdf;type=application/pdf'

Can it be an issue with the S3 connection? How could I trouble shoot it?

Thanks,
Julio

@juliosarachaga

Kindly share some details about how you have configured the storage “files-demo-development” and generated the JWT token in Docker.

Using docker compose we configured:

name: tog-dev
version: '3.8'
services:
  groupdocs-conversion-cloud:
    image: groupdocs/conversion-cloud:latest
    volumes:
      - ./groupdocs-data:/data
    ports:
      - 8081:80
    environment:
      - 'LICENSE_PUBLIC_KEY='
      - 'LICENSE_PRIVATE_KEY='
      - 'CLIENT_ID=<CLIENT_ID>'
      - 'CLIENT_SECRET=<CLIENT_SECRET>'
      - 'S3_STORAGE_BUCKET=files-demo-development'
      - 'S3_STORAGE_ACCESS_KEY=<AWS_ACCESS_KEY>'
      - 'S3_STORAGE_SECRET_KEY=<AWS_SECRET_KEY>'
      - 'S3_STORAGE_REGION=us-east-1'

The bearer token I generated it using the client_id and client_secret.

The policy for the s3 user is the following:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "s3:ListBucket",
            "Resource": "arn:aws:s3:::files-demo-development"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
                "s3:DeleteObjectTagging",
                "s3:PutObject",
                "s3:GetObject",
                "s3:ListBucketVersions",
                "s3:GetObjectTagging",
                "s3:PutObjectTagging",
                "s3:GetBucketVersioning",
                "s3:DeleteObject",
                "s3:GetObjectVersionAttributes",
                "s3:GetObjectVersion"
            ],
            "Resource": [
                "arn:aws:s3:::files-demo-development/*",
                "arn:aws:s3:::files-demo-development"
            ]
        }
    ]
}

I just tested without using the storage and it worked fine, maybe a miss-configuration on the policy?

@juliosarachaga

Our test account is working as expected. Can you please verify your s3 credentials?

That was the issue… Someone share the wrong credentials to me.

Thanks!

1 Like

@juliosarachaga

Thanks for your feedback. It is good to know that you have managed to resolve the issue.