Skip to content

Step Function's third party API integration has stopped working

0

Hi, I'm trying to do an extremely simple call to the Docker Hub API. It was previously working without issues but now causes the following error:

{
  "cause": "Unsupported response content-type 'application/vnd.oci.image.index.v1+json'. Please see documentation for list of unsupported content-types.",
  "error": "States.Runtime",
  "status": "RETRIABLE"
}

I've checked the documentation and JSON isn't listed as an unsupported content-type. The debug trace returns the following (additionally the debug can read the JSON just fine - it allows me to expand and collapse the response):

{
  "cause": "Unsupported response content-type 'application/vnd.oci.image.index.v1+json'. Please see documentation for list of unsupported content-types.",
  "error": "States.Runtime",
  "inspectionData": {
    "afterInputPath": "{}",
    "afterParameters": "{\"Headers\":{\"Accept\":[\"application/vnd.docker.distribution.manifest.v2+json\",\"application/vnd.docker.distribution.manifest.list.v2+json\"]},\"ApiEndpoint\":\"https://registry-1.docker.io/v2/library/php/manifests/latest\",\"Method\":\"GET\",\"Authentication\":{\"ConnectionArn\":\"redacted\"}}",
    "input": "{}",
    "request": {
      "headers": "{\"Authorization\":[\"Bearer redacted\"],\"Accept\":[\"application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json\"],\"User-Agent\":[\"Amazon|StepFunctions|HttpInvoke|eu-west-1\"],\"Range\":[\"bytes=0-262144\"]}",
      "method": "GET",
      "protocol": "https",
      "url": "https://registry-1.docker.io/v2/library/php/manifests/latest"
    },
    "response": {
      "body": "{\"manifests\":[\"valid json omitted for brevity\"],\"mediaType\":\"application\\/vnd.oci.image.index.v1+json\",\"schemaVersion\":2}",
      "headers": "{\"date\":[\"Mon, 18 Nov 2024 13:43:30 GMT\"],\"content-length\":[\"10352\"],\"ratelimit-limit\":[\"100;w=21600\"],\"docker-ratelimit-source\":[\"redacted\"],\"docker-distribution-api-version\":[\"registry/2.0\"],\"docker-content-digest\":[\"sha256:redacted\"],\"ratelimit-remaining\":[\"99;w=21600\"],\"etag\":[\"\\\"sha256:redacted\\\"\"],\"content-type\":[\"application/vnd.oci.image.index.v1+json\"],\"strict-transport-security\":[\"max-age=31536000\"]}",
      "protocol": "https",
      "statusCode": "200",
      "statusMessage": "OK"
    }
  },
  "status": "RETRIABLE"
}

so I have no idea why it's complaining. Here is the step definition:

{
  "Type": "Task",
  "Resource": "arn:aws:states:::http:invoke",
  "Parameters": {
    "Headers": {
      "Accept": [
        "application/vnd.docker.distribution.manifest.v2+json",
        "application/vnd.docker.distribution.manifest.list.v2+json"
      ]
    },
    "ApiEndpoint": "https://registry-1.docker.io/v2/library/php/manifests/latest",
    "Method": "GET",
    "Authentication": {
      "ConnectionArn": "redacted"
    }
  },
  "Retry": [
    {
      "ErrorEquals": [
        "States.ALL"
      ],
      "BackoffRate": 2,
      "IntervalSeconds": 1,
      "MaxAttempts": 3,
      "JitterStrategy": "FULL"
    }
  ],
  "Next": "Format API output",
  "ResultSelector": {
    "Output.$": "States.StringToJson($.ResponseBody)"
  },
  "OutputPath": "$.Output.manifests[?(@.platform.os =~ /linux/ && @.platform.architecture =~ /arm64|amd64/)].digest"
}

Thanks in advance! Jon

1 Answer
-1

The issue you're experiencing is related to the content type returned by the Docker Hub API. While your Step Function is requesting specific content types in the Accept header, the API is responding with a different content type that Step Functions doesn't currently support.

The error message indicates that the response has a content-type of 'application/vnd.oci.image.index.v1+json', which is not in the list of supported content types for AWS Step Functions' HTTP task.

To resolve this issue, you have a few options:

  1. Contact AWS Support: Since this appears to be a limitation in Step Functions' HTTP task, you might want to reach out to AWS Support to inquire about adding support for this content type.

  2. Use a Lambda function: As a workaround, you could create a Lambda function to make the HTTP request to the Docker Hub API. Lambda functions give you more control over handling different content types and can process the response before passing it back to your Step Function.

  3. Check with Docker Hub: You might want to check if there's a way to request a different content type from the Docker Hub API that matches one of the supported types in Step Functions.

  4. Modify your request: Try adjusting your Accept header to include the content type that's being returned. Although this might not solve the issue directly, it could provide more information about why the API is responding with this specific content type.

For now, the most reliable workaround would be to use a Lambda function to make the API call. This would allow you to handle the response regardless of its content type and then pass the processed data back to your Step Function.

Remember to update your IAM roles and permissions accordingly if you decide to introduce a Lambda function into your workflow.
Sources
Community | Third-party API integration in AWS Step-Functions
Community | Call external APIs with OAuth within Step Functions
External endpoints and testing of task states now available in AWS Step Functions | AWS News Blog

answered 2 years ago

  • How do I contact support? I can't find a way to do so without paying a ransom.

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.