-
Notifications
You must be signed in to change notification settings - Fork 28
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
Support custom AWS.Config instance via awsConfig option #135
base: master
Are you sure you want to change the base?
Conversation
618eca7
to
825d79d
Compare
e4cf186
to
6416e0b
Compare
@mcwhittemore / @rclark cool if I assign one of you (or both) as a reviewer + assignee for next steps? Thanks! |
Thanks for the PR and for the very thoughtful comments!
I tend to agree with you here. And if that's a direction that we're comfortable with, I would rather just jump on the breaking API change than role a minor bump slapping additional Could the second arg just be the options object that gets handed to AWS.Config constructor, instead of requiring the caller to instantiate? |
Stoked that you are on board with rolling an alternative signature (and thanks for the quick reply!). It came to my attention while reviewing the codebase that there are 2 additional Dyno-specific parameters that can be specified via My gut says that, with this complication, it might be more appropriate to preserve the option hash but make it much more restrictive and require all AWS properties to be provided in an Something like:
There's probably no harm in simply allowing devs to attach the Allowing an optional 3rd arguments is also a possibility:
Bottom line, anything that allows devs to provide the full set of Thanks again! |
If we're going to break this signature, I think we should talk about making table not required. There are a fair number of times where I want to use Dyno on many or zero tables. To get around this currently, I just toss, 'test' in for the table argument, but this always feels messy. |
I didn't even realize that was a use case. IOW, you throw table in as a param on each request? Yeah, if
|
OTOH my experience is that 90% of the time I use dyno, I'm operating against just one table. This was the motivation for adding the simple @knksmith57 I am still curious why we would ever ask the user to provide a configured AWS.Config instance instead of just a vanilla options object? |
@rclark there's really no point in enforcing an actual instance of The only differences that I see by introspecting the instance are some internal class definitions:
So, to more directly answer your question:
I don't think there's any sense in requiring it. It may, however, be much more desirable by devs familiar with the SDK to pass one in. Does my position make sense / does the explanation seem sound? |
🤷♂️ I've never actually instantiated a AWS.Config object explicitly myself -- I always pass a JS object to a service client constructor. Gonna talk this over a bit more with @mcwhittemore and see what comes out of that convo. Will get back here in the next day or two. @knksmith57 are you blocked or anything here? We have to be cautious about breaking the API and it probably won't happen quick. |
Awesome, thanks for your consideration and transparency through all of this. I'm blocked from switching to dyno on this feature, yes. We tune a few of the unreachable parameters for our application and the common pattern in the codebase is to reuse a configured Notably, we use bluebird for the promise dependency and, in some environments, set I'd rather we do this right then rush it for me. But I'm also of the mindset that there isn't a single right solution to this. Just preferences for the interface. Thanks and please let me know how I can help! |
Could the signature just be |
Meh. Thinking this over more, I kind of disagree with just accepting the AWS.config. It will lead to a bunch of checking to make sure the configs are like in the ways we need them to be (ie, params.TableName) and will require users to write more |
Agreed. I think making The idea of having the signature be |
@knksmith57 - In talking with @rclark about this, we're going to keep the read/write double config in If it is not an AWS config service:
Does this seem right to you? Can you take a stab at updating this PR? Once it's ready, I can make sure it gets published quickly. |
@mcwhittemore to ensure I understand your request correctly, you're saying the new signature should be:
Is that right? Also, I don't follow exactly what you mean by:
Are any attributes actually needed? If the idea here is to overload the Dyno factory to accept either a Dyno options hash or an instance of As a side note, it occurs to me that simply accepting an |
We don't support a read-only SDK, with
Is this true? What options does Dyno currently support that you can't get by configuring AWS.Config?
One thing Dyno does is change the default timeout, so while no attributes are needed by AWS, Dyno should always provide this timeout. So |
First off, awesome work on this module. Y'all have written some high quality, well documented code and I'm excited to use it. Thank you very much for this excellent OSS contribution.
This PR adds support for a new
option.awsConfig
property and fulfills the AC from #133. It's a non-breaking change and was coded that way on purpose (more on this below).In the future, I think it'd be best (and cleaner) to update the
Dyno
factory signature to make supplyingAWS.Config
a first-class citizen. The current implementation is a mask over all the available properties supported byAWS.DynamoDB
with an additional, top-leveltable
property and a requiredregion
property. This is problematic for 2 reasons:region
shouldn't be required as an option to Dyno. Theaws-js-sdk
supports setting the region in a number of different ways (eg: viaAWS_REGION
environment variable), so there's no need (that I'm aware of?) to enforce it in Dyno.I think a better signature would be
Dyno(String table, AWS.Config config)
. It is possible to roll this as a non-breaking change by doing a # args / type check, but it feels dirty. Open to suggestions here. Depending on if y'all are willing to make a breaking API change, this may be something that would be useful to implement now with the type checks, deprecate the existing API, then hard break at the major bump. Just my $0.02.Please let me know what you think! We'd really love to start using this but need fine-grain control over the SDK.
Thanks!