Error when Cognito tries to refresh credentials by itself - amazon-iam

I am getting an error code that looks like this but don't really know why.
So up till this point i was using amazons end to end implementation of developer authentication. Everything seems to work but as soon as i try to use dynamodb to do something i get this error.
AWSiOSSDKv2 [Error] AWSCredentialsProvider.m line:528 | __40-[AWSCognitoCredentialsProvider refresh]_block_invoke352 | Unable to refresh. Error is [Error Domain=com.amazonaws.service.cognitoidentity.DeveloperAuthenticatedIdentityProvider Code=0 "(null)"]
The request failed. Error: [Error Domain=com.amazonaws.service.cognitoidentity.DeveloperAuthenticatedIdentityProvider Code=0 "(null)"]
Any help?
UPDATE 1: LOG OUTPUT FROM COGNITOSYNCDEMO
I removed out the information i thought should be private and replaced it with [redacted info]
2016-02-19 15:32:42.594 CognitoSyncDemo[2895:67542] initializing clients...
2016-02-19 15:32:43.028 CognitoSyncDemo[2895:67542] json: { "identityPoolId": "[redacted info]", "identityId": "[redacted info]", "token": "[redacted info]",}
2016-02-19 15:32:43.056 CognitoSyncDemo[2895:67542] Error in registering for remote notifications. Error: Error Domain=NSCocoaErrorDomain Code=3010 "REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION" UserInfo={NSLocalizedDescription=REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION}
2016-02-19 15:32:54.449 CognitoSyncDemo[2895:67542] AWSiOSSDKv2 [Debug] AWSCognitoSQLiteManager.m line:1455 | -[AWSCognitoSQLiteManager filePath] | Local database is: /Users/MrMacky/Library/Developer/CoreSimulator/Devices/29BB1E0D-538D-4167-9069-C02A0628F1B3/data/Containers/Data/Application/1A86E139-5484-4F29-A3FD-25F81DE055EB/Documents/CognitoData.sqlite3
2016-02-19 15:32:54.451 CognitoSyncDemo[2895:67542] AWSiOSSDKv2 [Debug] AWSCognitoSQLiteManager.m line:221 | __39-[AWSCognitoSQLiteManager getDatasets:]_block_invoke | query = 'SELECT Dataset, LastSyncCount, LastModified, ModifiedBy, CreationDate, DataStorage, RecordCount FROM CognitoMetadata WHERE IdentityId = ?'
2016-02-19 15:33:00.946 CognitoSyncDemo[2895:67542] json: { "identityPoolId": "[redacted info]", "identityId": "[redacted info]", "token": "[redacted info]",}
2016-02-19 15:33:00.947 CognitoSyncDemo[2895:67542] AWSiOSSDKv2 [Error] AWSCognitoService.m line:215 | __36-[AWSCognito refreshDatasetMetadata]_block_invoke180 | Unable to list datasets: Error Domain=com.amazon.cognito.AWSCognitoErrorDomain Code=-4000 "(null)"

Looking at the exception, it looks like you are trying to do push sync from the emulator. You cannot receive remote notifications on an Emulator.

Related

Facing redis problem: unknown command `config`, with args beginning with: `set` on amazon linux

I am trying to get around this problem since yesterday but no matter what I do, I just cannot make redis to execute for my project. Here are the details in steps:
Step 1: I created new setup for redis using Elasticache in aws console, then I copied the url mentioned in primary endpoint e.g. my-redisxxxxx.cache.amazonaws.com. Thereafter, I assigned custom parameter group to this cluster from aws console where I have also configured the "notify-keyspace-events" in following way:
It still breaks even if I select default parameter group and don't assign this key.
Step 2: I made ssh connection to my nodejs EC2 instance and went to the environment variables file and assigned this url in this way:
REDIS_URI="my-redisxxxxx.cache.amazonaws.com"
REDIS_HOST="my-redisxxxxx.cache.amazonaws.com"
REDIS_PORT=6379
REDIS_INDEX=14
Now all other configurations are working fine in this manner, even redis works if I replace above url with one another existing cluster url. Only this particular new cluster that I made using elasticache seems to be having some problem.
As soon as I run node project using pm2, it hits the wall and throws this:
subscribed to channel ===> __keyevent#14__:expired
0|npm | events.js:377
0|npm | throw er; // Unhandled 'error' event
0|npm | ^
0|npm | ReplyError: ERR unknown command `config`, with args beginning with: `set`, `notify-keyspace-events`, `AKE`,
0|npm | at parseError (/usr/share/nginx/project-directory/node_modules/redis-parser/lib/parser.js:193:12)
0|npm | at parseType (/usr/share/nginx/project-directory/node_modules/redis-parser/lib/parser.js:303:14)
0|npm | Emitted 'error' event on RedisClient instance at:
0|npm | at Object.callbackOrEmit [as callback_or_emit] (/usr/share/nginx/project-directory/node_modules/redis/lib/utils.js:91:14)
0|npm | at RedisClient.return_error (/usr/share/nginx/project-directory/node_modules/redis/index.js:706:11)
0|npm | at JavascriptRedisParser.returnError (/usr/share/nginx/project-directory/node_modules/redis/index.js:196:18)
0|npm | at JavascriptRedisParser.execute (/usr/share/nginx/project-directory/node_modules/redis-parser/lib/parser.js:572:12)
0|npm | at Socket.<anonymous> (/usr/share/nginx/project-directory/node_modules/redis/index.js:274:27)
0|npm | at Socket.emit (events.js:400:28)
0|npm | at Socket.emit (domain.js:475:12)
0|npm | at addChunk (internal/streams/readable.js:293:12)
0|npm | at readableAddChunk (internal/streams/readable.js:267:9)
0|npm | at Socket.Readable.push (internal/streams/readable.js:206:10)
0|npm | at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
0|npm | command: 'CONFIG',
0|npm | args: [ 'set', 'notify-keyspace-events', 'AKE' ],
0|npm | code: 'ERR'
0|npm | }
0|npm | npm
0|npm | ERR! code ELIFECYCLE
0|npm | npm
0|npm | ERR! errno 1
0|npm | npm ERR!
I spent countless hours to understand this problem by reading documentation, only to find out that config command is restricted in aws elasticache. Also I found this answer here however not able to adapt it in my current code as I am creating redis connection like this (also I am not sure whether this is good solution):
const sub = redis.createClient(options);
export const subscribe = async (channel: string) => {
try {
sub.subscribe(channel);
console.log(`subscribed to channel ===> ${channel}`);
return {};
}
catch (error) {
console.log("Error while subscribing to a channel", error);
return {}
}
}
I am completely lost now as not able to think over what can solve this.
For those who are having similar problem, I was able to solve this by commenting out this line: this.client.config('set', 'notify-keyspace-events', 'AKE'); from connectRedisDB() function located inside redis.database.ts. I have commented this line because this parameter is already set in parameter group for redis from aws console, as state above in image.

Error returned: 'OLE DB or ODBC error: [DataSource.Error] Teradata: [Teradata Database] [3119] Continue request submitted but no response to return

Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: [DataSource.Error] Teradata: [Teradata Database] [3119] Continue request submitted but no response to return..
'.
When trying to connect a View to my power bi file, I get the above error when around 25M records are imported. I do not have any issue on smaller tables.

Can't execute AWS Lambda function built with Micronaut and Graal: Error decoding JSON stream

I built a native java AWS Lambda function using Graal and Micronaut as explained here
After deploying it to AWS Lambda (custom runtime), I can't successfully execute it.
The error that AWS shows is:
{
"errorType": "Runtime.ExitError",
"errorMessage": "RequestId: 9a231ad9-becc-49f7-832a-f9088f821fb2 Error: Runtime exited with error: exit status 1"
}
The AWS log output is:
START RequestId: 9a231ad9-becc-49f7-832a-f9088f821fb2 Version: $LATEST
01:13:08.015 [main] INFO i.m.context.env.DefaultEnvironment - Established active environments: [ec2, cloud, function]
Error executing function (Use -x for more information): Error decoding JSON stream for type [request]: No content to map due to end-of-input
at [Source: (BufferedInputStream); line: 1, column: 0]
END RequestId: 9a231ad9-becc-49f7-832a-f9088f821fb2
REPORT RequestId: 9a231ad9-becc-49f7-832a-f9088f821fb2 Duration: 698.31 ms Billed Duration: 700 ms Memory Size: 512 MB Max Memory Used: 54 MB
RequestId: 9a231ad9-becc-49f7-832a-f9088f821fb2 Error: Runtime exited with error: exit status 1
Runtime.ExitError
But when I test it locally using
echo '{"value":"testing"}' | ./server
I got
01:35:56.675 [main] INFO i.m.context.env.DefaultEnvironment - Established active environments: [function]
{"value":"New value: testing"}
The function code is:
#FunctionBean("user-data-function")
public class UserDataFunction implements Function<UserDataRequest, UserData> {
private static final Logger LOG = LoggerFactory.getLogger(UserDataFunction.class);
private final UserDataService userDataService;
public UserDataFunction(UserDataService userDataService) {
this.userDataService = userDataService;
}
#Override
public UserData apply(UserDataRequest request) {
if (LOG.isDebugEnabled()) {
LOG.debug("Request: {}", request.getValue());
}
return userDataService.get(request.getValue());
}
}
And the UserDataService is:
#Singleton
public class UserDataService {
public UserData get(String value) {
UserData userData = new UserData();
userData.setValue("New value: " + value);
return userData;
}
}
To test it on AWS console, I configured the following test event:
{ "value": "aws lambda test" }
PS.: I uploaded to AWS Lambda a zip file that contains the "server" and the "bootstrap" file to allow the "custom runtime" as explained before.
What I'm doing wrong?
Thanks in advance.
Tiago Peixoto.
EDIT: added the lambda test event used on AWS console.
Ok, I figured it out. I just changed the bootstrap file from this
#!/bin/sh
set -euo pipefail
./server
to this
#!/bin/sh
set -euo pipefail
# Processing
while true
do
HEADERS="$(mktemp)"
# Get an event
EVENT_DATA=$(curl -sS -LD "$HEADERS" -X GET "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/next")
REQUEST_ID=$(grep -Fi Lambda-Runtime-Aws-Request-Id "$HEADERS" | tr -d '[:space:]' | cut -d: -f2)
# Execute the handler function from the script
RESPONSE=$(echo "$EVENT_DATA" | ./server)
# Send the response
curl -X POST "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/$REQUEST_ID/response" -d "$RESPONSE"
done
as explained here

Amazon Lex: can't make mobile app work

I have a bot that works perfectly in the AWS console.
I've tried to make it work in a mobile app using AWS MobileHub but it doesn't work well and I don't know why I'm totally stuck.
Description: I make a request with a project name to get the list of tasks on this project. But first I have to connect. The "connection" request gets a token from my backend and put it in sessionAttributes. The other requests must have this token in sessionAttributes or the bot will ask to authenticate.
The workflow works with the AWS console bot:
Request "tasks for project 123" -> Answer "you must authenticate"
Request "connection" -> Answer "you are now connected"
Request "tasks for project 123" -> Answer "tasks for project 123
are 4, 8, 11. Choose a task to get details."
Now what happens with the app, in text mode:
Request "tasks for project 123" -> Answer "you must authenticate"
Request "connection" -> No answer
Request "tasks for project 123" -> The app crashes
Logs in Android Studio at step 3 (crash):
06-28 11:05:58.942 1719-1719/com.amazon.mysampleapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.amazon.mysampleapp, PID: 1719
Theme: themes:{default=overlay:com.cyngn.hexo, iconPack:com.cyngn.hexo, fontPkg:com.cyngn.hexo, com.android.systemui=overlay:com.cyngn.hexo, com.android.systemui.navbar=overlay:com.cyngn.hexo}
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.amazonaws.mobileconnectors.lex.interactionkit.continuations.LexServiceContinuation.continueWithTextInForTextOut(java.lang.String)' on a null object reference
at com.mysampleapp.demo.bots.ConversationalBotTextFragment.textEntered(ConversationalBotTextFragment.java:135)
at com.mysampleapp.demo.bots.ConversationalBotTextFragment.access$000(ConversationalBotTextFragment.java:42)
at com.mysampleapp.demo.bots.ConversationalBotTextFragment$1.onKey(ConversationalBotTextFragment.java:86)
at android.view.View.dispatchKeyEvent(View.java:9236)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at com.android.internal.policy.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:2651)
at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1777)
at android.app.Activity.dispatchKeyEvent(Activity.java:2731)
at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:543)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:53)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:312)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:53)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2363)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4135)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4097)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3703)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3669)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3795)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3677)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3852)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3703)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3669)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3677)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5932)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5906)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5867)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3442)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
06-28 11:05:58.944 789-3750/? W/ActivityManager: Force finishing activity com.amazon.mysampleapp/com.mysampleapp.MainActivity
And here with the voice on mobile app:
Request "tasks for project 123" -> Answer "you must authenticate"
Request "connection" -> Answer "you are now connected"
Request "tasks for project 123" -> Answer "you must authenticate"
Logs in Android Studio at steps 1 and 3:
06-28 11:24:15.227 4265-4265/com.amazon.mysampleapp E/Lex: InteractiveVoiceViewAdapter: Interaction error
com.amazonaws.mobileconnectors.lex.interactionkit.exceptions.DialogFailedException: Failed to fulfill current request.
at com.amazonaws.mobileconnectors.lex.interactionkit.InteractionClient$8.run(InteractionClient.java:593)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
06-28 11:24:15.227 4265-4265/com.amazon.mysampleapp E/ConversationalBotVoice: Error: You must authenticate.
com.amazonaws.mobileconnectors.lex.interactionkit.exceptions.DialogFailedException: Failed to fulfill current request.
at com.amazonaws.mobileconnectors.lex.interactionkit.InteractionClient$8.run(InteractionClient.java:593)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
So I tried to change the lambda so I don't need the connection part (but still it uses the token for the requests, I've just written the token in the lambda instead of getting it from the backend).
In AWS console, I get the tasks list
On mobile with text, I get the tasks list
On mobile with voice, it doesn't work
And the logs for that last case:
06-28 11:38:40.619 7655-7655/com.amazon.mysampleapp E/Lex: InteractiveVoiceViewAdapter: Interaction error
com.amazonaws.services.lexrts.model.DependencyFailedException: Received error response from Lambda: Handled (Service: AmazonLexRuntime; Status Code: 424; Error Code: DependencyFailedException; Request ID: 8f30ae21-5be5-11e7-bc7b-8d61d03f20da)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:729)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:405)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:212)
at com.amazonaws.services.lexrts.AmazonLexRuntimeClient.invoke(AmazonLexRuntimeClient.java:651)
at com.amazonaws.services.lexrts.AmazonLexRuntimeClient.postContent(AmazonLexRuntimeClient.java:450)
at com.amazonaws.mobileconnectors.lex.interactionkit.InteractionClient$2.run(InteractionClient.java:375)
at java.lang.Thread.run(Thread.java:818)
06-28 11:38:40.620 7655-7655/com.amazon.mysampleapp E/ConversationalBotVoice: Error: Error from Bot
com.amazonaws.services.lexrts.model.DependencyFailedException: Received error response from Lambda: Handled (Service: AmazonLexRuntime; Status Code: 424; Error Code: DependencyFailedException; Request ID: 8f30ae21-5be5-11e7-bc7b-8d61d03f20da)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:729)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:405)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:212)
at com.amazonaws.services.lexrts.AmazonLexRuntimeClient.invoke(AmazonLexRuntimeClient.java:651)
at com.amazonaws.services.lexrts.AmazonLexRuntimeClient.postContent(AmazonLexRuntimeClient.java:450)
at com.amazonaws.mobileconnectors.lex.interactionkit.InteractionClient$2.run(InteractionClient.java:375)
at java.lang.Thread.run(Thread.java:818)
I don't know what to do, I don't even know how to log things, how to check what is sent to Lex from the app and what Lex sends back. Thanks for your help.

Unable to Post a csv file in Postman, getting 400 error

I am trying to post a csv file and get the fields(fields in the csv file) in the response using Postman but I am getting 400 Bad request error.
Error:
{
"status": 400,
"error": "Bad Request",
"message": "Required request part 'inFile' is not present",
"timeStamp": "Tue Feb 07 00:00:17 EST 2017",
"trace": "org.springframework.web.multipart.support.MissingServletRequestPartException: Required request part 'inFile' is not present\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestPartMethodArgumentResolver.resolveArgument(RequestPartMethodArgumentResolver.java:192)\n\tat org.springframework.web.method.support.HandlerMethodArgumentResolverComposite....}
Please let me know how to overcome this issue as I am new to this.
You forgot to give a name to your form-data parameter.
According to the error you got the name of the key should be "inFile".
And you need to input it here: