-
Notifications
You must be signed in to change notification settings - Fork 181
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
DynamoDB Credential for sim #6463
Comments
I have now tried the following:
let sessionDbConnection: dynamodb.Connection = {
tableName: sessionTable.tableName,
clientConfig: {
endpoint: "http://localhost:3000",
region: AwsRegion,
credentials: {
accessKeyId: "local",
secretAccessKey: "local"
},
}
};
new(options: types.SessionHandlerOptions) {
this._credentials = options.clientOptions?.clientConfig?.credentials;
}
let client = new dynamodb.Client({
tableName: this._table.tableName,
credentials: {
accessKeyId: this._credentials?.accessKeyId!,
secretAccessKey: this._credentials?.secretAccessKey!
}
}); I am now encountering the following error: UnrecognizedClientException: The security token included in the request is invalid. I am either doing it wrong and cannot read the docs (sic) or the local isn't being respected. |
Ideally, you don't have to create a DynamoDB client by yourself. You should use the inflight API of the table directly, as in:
The credentials, client instantiation and function permissions are managed for you this way. |
The test https://github.com/winglang/winglibs/blob/main/dynamodb/tests/connection.test.w shows how to retrieve the table connection details (if you need to use them outside of wing), but I'm not sure that's your case here. |
Part of the confusion is that there are two structs called "Credentials" in the dynamodb winglib.
So wing considers these different types, and currently we don't structurally type check these so it fails (opened #6467 for this). |
@skyrpex I have followed your suggestion and used a |
@MarkMcCulloh Ok so already known issue. Feels free to close this. Thank you. |
Good catch, I can refactor that type... Here: winglang/winglibs#232 |
I tried this:
I have tried to hardcode the credentials for the sim as per the test: https://github.com/winglang/winglibs/blob/main/dynamodb/tests/connection.test.w
This happened:
Still getting the following error message:
UnrecognizedClientException: The security token included in the request is invalid.
I expected this:
The credentials to be accepted as is
Is there a workaround?
Need to figure out how to give it actual credentials
Anything else?
Might need to figure out if Wing is capable to read creds from Leapp: https://www.leapp.cloud/
Wing Version
0.73.41
Node.js Version
20.11.0
Platform(s)
MacOS
Community Notes
The text was updated successfully, but these errors were encountered: