Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apigateway client :embed ["methods"] doesn't work #206

Closed
mtwomey opened this issue Feb 14, 2022 · 8 comments
Closed

apigateway client :embed ["methods"] doesn't work #206

mtwomey opened this issue Feb 14, 2022 · 8 comments
Assignees

Comments

@mtwomey
Copy link

mtwomey commented Feb 14, 2022

When making a basic apigateway request, the :embed keyword doesn't cause the client to return the embedded values:

(def apigateway (aws/client {:api :apigateway :credentials-provider (credentials/profile-credentials-provider)}))
(aws/invoke apigateway {:op :GetResources :request {:restApiId "el0mjiybr1" :embed ["methods"]}})

Adding this parameter is supposed to enrich the returned data with method detail on each resource. The request succeeds, but only the "un-enriched" data is returned (as if the embed parameter was not used).

By comparison, this works fine with the AWS command-line client:

aws apigateway get-resources --rest-api-id=el0mjiybr1 --embed methods

Note: I believe this issue makes it impossible to retrieve api-gateway method detail using this cognitect library as this is the only way to do it.

@mtwomey
Copy link
Author

mtwomey commented Feb 14, 2022

A little additional investigation and I see that the request being made actually looks correct. This URI matches the AWS spec for this call. So potentially the result is not being mapped correctly?

image

@mtwomey
Copy link
Author

mtwomey commented Apr 10, 2022

I'm a little unclear what to do here. I could try to fix it myself, but your README.md says you don't accept pull requests. Do you actively address bugs like these on your own or am I better off just forking and maintaining my own version?

@mtwomey
Copy link
Author

mtwomey commented May 18, 2022

Checking back if anyone has had a look?

@dchelimsky
Copy link
Contributor

Hi @mtwomey. Haven't had a chance to look at this yet. We do maintain this library, but don't have enough bandwidth to keep on top of everything. We're working on that!

At quick glance, the content-type returned from AWS is "application/hal+json", and aws-api is parsing it accordingly, but I need to look closer at what's in the original body and what aws-api is doing with it. I'll follow up as I learn things.

@dchelimsky dchelimsky self-assigned this May 26, 2022
@dchelimsky
Copy link
Contributor

I started to look a little deeper and the json payload AWS sends back has keys like "resource:methods" as opposed to "resourceMethods", which is what is advertised in their docs. I'll keep looking, and it may be a while, but at least there's a hint.

@dchelimsky
Copy link
Contributor

Found the issue.

The problem was that we interpreted #30 incorrectly and tried to solve for parsing HAL instead of recognizing that we should not be receiving HAL at all. There are no instructions for processing HAL in the service descriptions and, as it turns out, AWS will send us json that parses correctly if we ask it to (accept header).

Release with fix forthcoming.

@dchelimsky
Copy link
Contributor

Fixed in aws-api-0.5.561

@mtwomey
Copy link
Author

mtwomey commented Jul 27, 2022

Awesome! Thanks so much @dchelimsky !!!

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

No branches or pull requests

2 participants