You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I put together a test function for lambda, but the credentials are not set into the SDK.
-- Error: Missing credentials in config
Am I using the same copy of the SDK as amplify?
Had amplify set the credentials into the SDK?
I also noted that AWS.config.region is not set either.
Previously I did setup like this:
AWS.config.update({region: 'us-east-1'});
AWS.config.credentials = new AWS.Credentials({
accessKeyId: sessionStorage.getItem('accessKeyId'),
secretAccessKey: sessionStorage.getItem('secretAccessKey'),
sessionToken: sessionStorage.getItem('sessionToken'),
});
But I had expected aws-amplify to set this up for me.
import React, { Component } from 'react';
import AWS from 'aws-sdk'
var Lambda = new AWS.Lambda({region: 'us-east-1', apiVersion: '2015-03-31'});
export default class Page2 extends Component {
build_table () {
// create JSON object for parameters for invoking Lambda function
var pullParams = {
FunctionName : 'digi-dev-getEvents',
InvocationType : 'RequestResponse',
LogType : 'None'
};
// create variable to hold data returned by the Lambda function
var events;
Lambda.invoke(pullParams, function(error, data) {
if (error) {
prompt(error);
} else {
events = JSON.parse(data.Payload);
var t = "<table border=1 padding=3>";
events.forEach(function(r) {
t += "<tr>";
var x = new Date( r["timestamp"] );
var formatted = x.toLocaleString();
t += "<td>" + formatted + "</td>";
t += "<td>" + r["thing"] + "</td>";
t += "<td>" + r["type"] + "</td>";
t += "</tr>";
});
t += "</table>";
console.log(t);
}
});
}
I put together a test function for lambda, but the credentials are not set into the SDK.
-- Error: Missing credentials in config
Am I using the same copy of the SDK as amplify?
Had amplify set the credentials into the SDK?
I also noted that AWS.config.region is not set either.
Previously I did setup like this:
AWS.config.update({region: 'us-east-1'});
AWS.config.credentials = new AWS.Credentials({
accessKeyId: sessionStorage.getItem('accessKeyId'),
secretAccessKey: sessionStorage.getItem('secretAccessKey'),
sessionToken: sessionStorage.getItem('sessionToken'),
});
But I had expected aws-amplify to set this up for me.
Do I need to do something like this?
I just expected amplify to supply me with a global AWS handle that always has valid credentials in it (ie refresh is taken care of).
The text was updated successfully, but these errors were encountered: