Skip to content

REST API doesn’t appear to be associated with my AWS account

0

I'm troubleshooting an AWS Lambda error where an API Gateway endpoint is failing with the following:

[ERROR] 2025-05-14T20:49:55.532Z 0a0d2660-7193-4a22-ac78-5cf00bea22ee Error in lambda_handler: 'dict' object has no attribute 'status'

After in-depth discussions with my AI friends, the consensus is:

“The Lambda you’re seeing run likely contains an older version of code with a bug like:

if response.status != 200: # ❌ Wrong: 'response' is a dict, not an object with 'status'

But that code doesn't exist in the version you just deployed. So it may be that the wrong Lambda version is running.”

That made me look at the API Gateway config more closely. Here's what is strange:

I'm using a REST API, but it doesn’t appear to be associated with my AWS account. When I try to list or fetch it, I get NotFoundException errors:

aws apigateway get-rest-apis --region us-east-1

{"items": []}

aws apigateway get-rest-api --rest-api-id k5h3w1h85i --region us-east-1

NotFoundException: Invalid API identifier specified

aws apigateway get-resources --rest-api-id k5h3w1h85i --region us-east-1

NotFoundException: Invalid API identifier specified

aws logs filter-log-events --log-group-name /aws/apigateway/k5h3w1h85i --region us-east-1

ResourceNotFoundException: The specified log group does not exist.

BUT the API ID k5h3w1h85i definitely exists — it’s being used!

For context: this is my personal AWS account, and I usually work as the root user. I suspected that might be part of the issue, so I configured the AWS CLI to use an admin-level IAM user instead — no change. I even created a brand new API and saw the same behavior.

Anyone seen anything like this before?

2 Answers
1

The situation you're describing is unusual and suggests there might be some discrepancies between what you're seeing and the actual state of your AWS resources. Here are a few potential explanations and steps to troubleshoot:

  1. Region Mismatch: Double-check that you're looking in the correct AWS region. The API Gateway might be deployed in a different region than the one you're querying.

  2. Account Mismatch: Verify that you're using the correct AWS account. It's possible that the API was created in a different AWS account.

  3. API Type: Ensure that you're using the correct API type. If it's an HTTP API instead of a REST API, you would need to use different CLI commands (apigatewayv2 instead of apigateway).

  4. Permissions: Even though you're using an admin-level IAM user, double-check the exact permissions. The user might be missing specific permissions for API Gateway operations.

  5. API Deletion: If the API was recently deleted, it might still be accessible for a short period but not show up in listings.

  6. CloudFormation Stack: If the API was created as part of a CloudFormation stack, try checking the stack status and resources.

  7. API Gateway Console: Try accessing the API through the AWS Management Console to see if it's visible there.

  8. CloudWatch Logs: Check if there are any CloudWatch logs for the API Gateway, which might provide more insights.

  9. Support Case: If none of the above helps, consider opening a support case with AWS. There might be an account-specific issue that requires their intervention.

As for the Lambda error, the explanation about an older version of the code running seems plausible. Check the Lambda function's version and alias settings to ensure you're invoking the correct version. Also, review the Lambda execution role to make sure it has the necessary permissions to interact with the API Gateway.

If the API truly exists and is being used, but you can't see or manage it, this could indicate a more serious issue with your account configuration or permissions. In this case, contacting AWS support would be the best course of action to resolve the discrepancy.
Sources
Cannot Remove APIs - Please remove all base path mappings related to the RestApi in your domains | AWS re:Post
AWS Gateway: API does not respond in Postman | AWS re:Post
API Gateway - Missing Authentication Token | AWS re:Post
Error Invoking Private REST API from Lambda Function | AWS re:Post

answered a year ago

EXPERT

reviewed a year ago

0
Accepted Answer

It is strange how you so often figure it out the moment after you post!

aws apigatewayv2 !

answered a year ago

EXPERT

reviewed 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.