Skip to content

fix: use ApiId as the resource id for apigatewayv2 APIs - #165

Merged
DaviReisVieira merged 1 commit into
DaviReisVieira:mainfrom
amjadjibon:fix/apigatewayv2-api-id
Sep 21, 2026
Merged

DaviReisVieira merged 1 commit into
DaviReisVieira:mainfrom
amjadjibon:fix/apigatewayv2-api-id

Conversation

@amjadjibon

Copy link
Copy Markdown
Contributor

Fixes #164

An apigatewayv2 list item carries both Name and ApiId. Name ranks ahead of ApiId in _ID_FIELDS, so _extract_id returned the name and the detail lookup called get_api(ApiId=""), which raises NotFoundException:

GET /api/resources/apigateway/apis/my-api -> 500
NotFoundException: API my-api not found

("apigateway", "apis") was missing from _PREFERRED_ID_FIELD, the map that exists to correct exactly this. #111 added the rest_apis override and missed the v2 sibling.

cli.py had the same bug on a second surface: it called _extract_id without the override at all, so stackport list printed the wrong id for every entry in _PREFERRED_ID_FIELD (route53, events, wafv2, appsync, elasticmapreduce, cognito-idp, apigateway) -- and that is the id a user would then pass to stackport describe. Thread preferred through both call sites.

An apigatewayv2 list item carries both Name and ApiId. Name ranks ahead
of ApiId in _ID_FIELDS, so _extract_id returned the name and the detail
lookup called get_api(ApiId="<name>"), which raises NotFoundException:

  GET /api/resources/apigateway/apis/my-api  -> 500
  NotFoundException: API my-api not found

("apigateway", "apis") was missing from _PREFERRED_ID_FIELD, the map that
exists to correct exactly this. DaviReisVieira#111 added the rest_apis override and
missed the v2 sibling.

cli.py had the same bug on a second surface: it called _extract_id without
the override at all, so `stackport list` printed the wrong id for every
entry in _PREFERRED_ID_FIELD (route53, events, wafv2, appsync,
elasticmapreduce, cognito-idp, apigateway) -- and that is the id a user
would then pass to `stackport describe`. Thread `preferred` through both
call sites.
@DaviReisVieira
DaviReisVieira merged commit 7ce77d4 into DaviReisVieira:main Sep 21, 2026
2 checks passed
@DaviReisVieira

Copy link
Copy Markdown
Owner

Merged!! Thanks for this one. The repro was a single command, the AWS references were right there, and the CLI part is something I would not have noticed on my own.

I checked it on MiniStack and Floci and it behaves the same on both. Turns out the same pattern hits five more resource types, I opened #170 for those. If you feel like taking that one too, the door is open!

@amjadjibon

Copy link
Copy Markdown
Contributor Author

Merged!! Thanks for this one. The repro was a single command, the AWS references were right there, and the CLI part is something I would not have noticed on my own.

I checked it on MiniStack and Floci and it behaves the same on both. Turns out the same pattern hits five more resource types, I opened #170 for those. If you feel like taking that one too, the door is open!

Thanks. I would like to work on that issue.

@amjadjibon
amjadjibon deleted the fix/apigatewayv2-api-id branch September 22, 2026 09:04
@DaviReisVieira

Copy link
Copy Markdown
Owner

It's yours!! Thanks. Everything you need is in #170: the five entries, the describe params, and the idea for the shape-based test. Ping me there if anything is unclear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

apigatewayv2 API detail always 500s: list emits Name as the resource id, get_api needs ApiId

2 participants