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

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.

Related

Unable to load strapi instance in unit testing

I am trying to run test cases for strapi but it is not allowing me to do so. I am using postgres database.
I have checked other answers and I have only one database.js file and not database.json
The error I get-
lerna ERR! yarn run test:local stderr:
● process.exit called with "1"
7 | async function setupStrapi() {
8 | if (!instance) {
> 9 | instance = await Strapi().load();
| ^
10 | await instance.app
11 | .use(instance.router.routes()) // populate KOA routes
12 | .use(instance.router.allowedMethods()); // populate KOA methods
at Strapi.stop (../../node_modules/strapi/lib/Strapi.js:316:13)
at Strapi.stopWithError (../../node_modules/strapi/lib/Strapi.js:302:17)
at ../../node_modules/strapi-connector-bookshelf/lib/mount-models.js:688:18
at module.exports (../../node_modules/strapi-connector-bookshelf/lib/mount-models.js:708:7)
at mountConnection (../../node_modules/strapi-connector-bookshelf/lib/index.js:84:7)
at async Promise.all (index 0)
at Object.initialize (../../node_modules/strapi-database/lib/connector-registry.js:30:9)
at DatabaseManager.initialize (../../node_modules/strapi-database/lib/database-manager.js:43:5)
at Strapi.load (../../node_modules/strapi/lib/Strapi.js:362:5)
at setupStrapi (tests/helpers/setup.js:9:16)
error Command failed with exit code 1.
Any leads to fix this?

argument --max-dispatches-per-second: invalid float value: '6/m'

I am using cloud tasks, I want to set maxDispatchesPerSecond to 6/m.
when I try to update my app engine queue with below command:
☁ rate-limit [master] ⚡ gcloud beta tasks queues update-app-engine-queue cloud-tasks-rate-limit --max-dispatches-per-second='6/m'
ERROR: (gcloud.beta.tasks.queues.update-app-engine-queue) argument --max-dispatches-per-second: invalid float value: '6/m'
Usage: gcloud beta tasks queues update-app-engine-queue QUEUE [optional flags]
optional flags may be --clear-max-attempts | --clear-max-backoff |
--clear-max-concurrent-dispatches |
--clear-max-dispatches-per-second |
--clear-max-doublings | --clear-max-retry-duration |
--clear-min-backoff | --clear-routing-override |
--help | --max-attempts | --max-backoff |
--max-concurrent-dispatches |
--max-dispatches-per-second | --max-doublings |
--max-retry-duration | --min-backoff |
--routing-override
For detailed information on this command and its flags, run:
gcloud beta tasks queues update-app-engine-queue --help
How can I to this?
The error it's giving you is:
ERROR: (gcloud.beta.tasks.queues.update-app-engine-queue) argument --max-dispatches-per-second: invalid float value: '6/m'
'6/m' isn't a valid value. It requires a floating point value. Compute the value you want, and just enter that number.

Error when Cognito tries to refresh credentials by itself

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.

NoHttpResponseException on uploading file to S3 (camel-aws)

I am trying to upload around 10 GB file from my local machine to S3 (inside a camel route). Although file gets uploaded in around 3-4 minutes, but it also throwing following exception:
2014-06-26 13:53:33,417 | INFO | ads.com/outbound | FetchRoute | 167 - com.ut.ias - 2.0.3 | Download complete to local. Pushing file to S3
2014-06-26 13:54:19,465 | INFO | manager-worker-6 | AmazonHttpClient | 144 - org.apache.servicemix.bundles.aws-java-sdk - 1.5.1.1 | Unable to execute HTTP request: The target server failed to respond
org.apache.http.NoHttpResponseException: The target server failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:95)[142:org.apache.httpcomponents.httpclient:4.2.5]
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62)[142:org.apache.httpcomponents.httpclient:4.2.5]
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)[141:org.apache.httpcomponents.httpcore:4.2.4]
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)[141:org.apache.httpcomponents.httpcore:4.2.4]
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)[142:org.apache.httpcomponents.httpclient:4.2.5]
at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)[142:org.apache.httpcomponents.httpclient:4.2.5]
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)[141:org.apache.httpcomponents.httpcore:4.2.4]
.......
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_55]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_55]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_55]
at java.lang.Thread.run(Thread.java:744)[:1.7.0_55]
2014-06-26 13:55:08,991 | INFO | ads.com/outbound | FetchRoute | 167 - com.ut.ias - 2.0.3 | Upload complete.
Due to which camel route doesn't stop and it is continuously throwing InterruptedException:
2014-06-26 13:55:11,182 | INFO | ads.com/outbound | SftpOperations | 110 - org.apache.camel.camel-ftp - 2.12.1 | JSCH -> Disconnecting from cxportal.integralads.com port 22
2014-06-26 13:55:11,183 | INFO | lads.com session | SftpOperations | 110 - org.apache.camel.camel-ftp - 2.12.1 | JSCH -> Caught an exception, leaving main loop due to Socket closed
2014-06-26 13:55:11,183 | WARN | lads.com session | eventadmin | 139 - org.apache.felix.eventadmin - 1.3.2 | EventAdmin: Exception: java.lang.InterruptedException
java.lang.InterruptedException
at EDU.oswego.cs.dl.util.concurrent.LinkedQueue.offer(Unknown Source)[139:org.apache.felix.eventadmin:1.3.2]
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor.execute(Unknown Source)[139:org.apache.felix.eventadmin:1.3.2]
at org.apache.felix.eventadmin.impl.tasks.DefaultThreadPool.executeTask(DefaultThreadPool.java:101)[139:org.apache.felix.eventadmin:1.3.2]
at org.apache.felix.eventadmin.impl.tasks.AsyncDeliverTasks.execute(AsyncDeliverTasks.java:105)[139:org.apache.felix.eventadmin:1.3.2]
at org.apache.felix.eventadmin.impl.handler.EventAdminImpl.postEvent(EventAdminImpl.java:100)[139:org.apache.felix.eventadmin:1.3.2]
at org.apache.felix.eventadmin.impl.adapter.LogEventAdapter$1.logged(LogEventAdapter.java:281)[139:org.apache.felix.eventadmin:1.3.2]
at org.ops4j.pax.logging.service.internal.LogReaderServiceImpl.fire(LogReaderServiceImpl.java:134)[50:org.ops4j.pax.logging.pax-logging-service:1.7.1]
at org.ops4j.pax.logging.service.internal.LogReaderServiceImpl.fireEvent(LogReaderServiceImpl.java:126)[50:org.ops4j.pax.logging.pax-logging-service:1.7.1]
at org.ops4j.pax.logging.service.internal.PaxLoggingServiceImpl.handleEvents(PaxLoggingServiceImpl.java:180)[50:org.ops4j.pax.logging.pax-logging-service:1.7.1]
at org.ops4j.pax.logging.service.internal.PaxLoggerImpl.inform(PaxLoggerImpl.java:145)[50:org.ops4j.pax.logging.pax-logging-service:1.7.1]
at org.ops4j.pax.logging.internal.TrackingLogger.inform(TrackingLogger.java:86)[18:org.ops4j.pax.logging.pax-logging-api:1.7.1]
at org.ops4j.pax.logging.slf4j.Slf4jLogger.info(Slf4jLogger.java:476)[18:org.ops4j.pax.logging.pax-logging-api:1.7.1]
at org.apache.camel.component.file.remote.SftpOperations$JSchLogger.log(SftpOperations.java:359)[110:org.apache.camel.camel-ftp:2.12.1]
at com.jcraft.jsch.Session.run(Session.java:1621)[109:org.apache.servicemix.bundles.jsch:0.1.49.1]
at java.lang.Thread.run(Thread.java:744)[:1.7.0_55]
Please see my code below and let me know, where I am going wrong:
TransferManager tm = new TransferManager(
S3Client.getS3Client());
// TransferManager processes all transfers asynchronously,
// so this call will return immediately.
Upload upload = tm.upload(
Utils.getProperty(Constants.BUCKET),
getS3Key(file.getName()), file);
try {
upload.waitForCompletion();
logger.info("Upload complete.");
} catch (AmazonClientException amazonClientException) {
logger.warn("Unable to upload file, upload was aborted.");
amazonClientException.printStackTrace();
}
The stacktrace doesn't even have any reference to my code, hence couldn't determine where the issue is.
Any help or pointer would be really appreciated.
Thanks

What are the potential status codes for AWS Auto Scaling Activities?

Here is the documentation for the Activity data type.
However, I think I've seen 4 status codes for the responses:
'Successful'
'Cancelled'
'InProgress'
'PreInProgress'
Are there any others?
Looks like they have updated the documentation, in the same url you have shared:
Valid Values: WaitingForSpotInstanceRequestId | WaitingForSpotInstanceId | WaitingForInstanceId | PreInService | InProgress | Successful | Failed | Cancelled