Comments (17)
I did some digging.
The JS SDK uses a QueryParamSerializer
in the query protocol.
It in its turn uses metadata from the spec to serialize the data.
The spec gives that the locationName
should be Value
.
Maybe it gives some pointers.
from aws_client.
Looks like we are not alone in this issue: pplu/aws-sdk-perl#267
Btw. I've just noticed, that the expected format not only flattens the Map of Map, but also removes the plural from the attribute name. Which is a bit tricky, but I guess we should do it too...
from aws_client.
I think this issue cannot be solved with the current [ShapeClass].toJson()
output and generic flatten method. We'll need to generate e.g. an inlined toFlatMap(String prefix)
that will provide the map based on the shape's config, and "inlined" values will (should) know what to do.
from aws_client.
@Dvoikin I don't have time to work on it in the near future, but send us a pull request and we'll have a look at it!
It seems @isoos gave it a shot, that commit can perhaps give some pointers.
from aws_client.
I previously lied when I said I didn't have time. Working on a PR right now XD
from aws_client.
This is a difficult problem. The data type SQS is using is rich:
https://github.com/agilord/aws_client/blob/master/generated/aws_sqs_api/lib/sqs-2012-11-05.dart#L2470-L2522
However, we only have the basic algorithm for flattening the arguments:
https://github.com/agilord/aws_client/blob/master/shared_aws_api/lib/src/protocol/query.dart#L92-L142
@Schwusch: any idea how we should approach this?
@lucasdina: do you happen to know the wire format of your request? (e.g. what should be the body format if you specify the attributes?)
from aws_client.
@isoos
Here's what the body should look like:
Action=SendMessage&MessageAttribute.1.Name=testAttribute&MessageAttribute.1.Type=String&MessageAttribute.1.Value=ab0c6c4e50ce4bcd8709eefdbd533a35&MessageBody=%7B%22test%22%3A+%22cool%22%7D&MessageDeduplicationId=8c1056b07c8f11eaf1cde9f670f7ada1&MessageGroupId=testGroup1&QueueUrl={mySQSUrl}&Version=2012-11-05
^^ Ignore this body. That is an incorrect format
MessageAttribute and MessageSystemAttribute (now shown) are both maps and have the same format with the exception of the object name. In my PR I pretty much hard coded the MessageAttribute prefixes.
from aws_client.
@lucasdina: Thanks!
That's even more interesting: we'd need to map DataType
to Type
, and StringValue
to Value
. I don't see anything in the JSON API spec that would help us to do that automatically.
@Schwusch: what if we introduce an interface that the shared API can interpret, and make a special case in the codegen for this MessageAttribute
? That seems to me the least bad resolution of this so far...
from aws_client.
Sorry, I don't have much time to dig in to this right now, but I would look at the Javascript implementation for reference. That would probably clarify things.
from aws_client.
@isoos I apologize, I accidently sent the wrong body. That was the one I had in my notes for some reason. This one is the one what SQS accepts:
Action=SendMessage&MessageAttribute.1.Name=testattrib&MessageAttribute.1.Value.DataType=String&MessageAttribute.1.Value.StringValue=test&MessageBody=%7B%22test%22%3A+%22cool%22%7D&MessageDeduplicationId=4a7f57c07cf611eaf1cde9f670f7ada1&MessageGroupId=AgriPayFarms&QueueUrl={sqsUrl}&Version=2012-11-05
It requires that extra '.Value' prefix.
from aws_client.
Ah, okay, the updated body seems to be better: we still need to generate a toJson() method for it, but it could be much more generic.
from aws_client.
@isoos The current flattening algorithm looks alright, the arguments just need to be json, as you said.
I guess the query
protocol has to be added in Api.generateToJson and the arguments has to be serialized here and here. I think that's a good start atleast.
from aws_client.
@Schwusch this issue is still actual for our project. When it will be fixed?
from aws_client.
This should be fixed in version 0.1.1. @Dvoikin @lucasdina Can you verify?
from aws_client.
I'll close this for now, the activity indicates that this issue is either solved or not a problem anymore.
from aws_client.
@Schwusch sorry for the delay. We checked your updates and, unfortunately, they do not work for AWS SNS. We are trying to configure the service for sending SMS. Below is the code:
var credentials = AwsClientCredentials(
accessKey: ***,
secretKey: ***);
sns = SNS(region: 'eu-west-1', credentials: credentials); // Error occurred here
We see the next error message: Exception has occurred.
_CastError (type '_ImmutableMap<dynamic, dynamic>' is not a subtype of type 'Map<String, dynamic>' in type cast)
In case when we put shapes = null
initialization instead of
shapes = shapesJson
.map((key, value) => MapEntry(key, _s.Shape.fromJson(value)));
in SNS class, it works, but, of course, we face issues later bc shapes are null.
Hopefully, it will help you. But it still doesn't work for us.
from aws_client.
Thanks for replying!
I just tried and adding SNS 0.1.1 to another project I'm working on, just initializing it like so:
final sns = SNS(region: 'eu-west-1', credentials: AwsClientCredentials(accessKey: '', secretKey: ''));
It compiled and did not throw any runtime errors. I suspect it will work if you run pub upgrade
in your project, getting the latest shared_aws_api
. Tell me if that doesn't work.
from aws_client.
Related Issues (20)
- No mechanism to discern response status code HOT 1
- Unable to access S3 via IAM role HOT 5
- Incompatilibty with `amplify_flutter` HOT 1
- NoSuchMethodError: Class 'double' has no instance method 'toJson'
- MalformedInput Sender: timestamp must follow ISO8601 HOT 7
- How to use Amazon S3 to down file by presigned URL
- Exception: credentials for signing request is null
- Topic Subscribe
- aws_polly_api could really use an example
- pub.dev will rate limit the publishing of packages
- How to send data to aws HOT 1
- Investigate why the analysis of aws_client is stuck on pub.dev HOT 1
- [bug] sts assumeRoleWithWebIdentity tries to sign request HOT 2
- s3 getObject `SignatureDoesNotMatch` if path contains a `:` HOT 5
- Method getObject returns the error 'NoSuchKey null: The specified key does not exist.'
- Cloudwatch Evidently package for Dart HOT 1
- publish of `shared_aws_api` needed to use package `http` >= 1.0.0 HOT 3
- How to upload data with multipart upload
- Unhandled Exception: Exception: public is not known in enum PortAccessType
- Please support accelerate when get and put object
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws_client.