Nest: Can't connect to AWS ElasticCache Redis

Created on 14 Apr 2019  路  4Comments  路  Source: nestjs/nest

I'm submitting a...


[ ] Regression 
[x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior


When my application is deployed to Amazon ECS, i'm not able to connect to ElasticCache Redis.

Minimal reproduction of the problem with instructions

  1. Set-up Amazon ECS container and Redis instance
  2. Set proper security grops
  3. Try to connect nestjs to redis:

const microservice = app.connectMicroservice({
    transport: Transport.REDIS,
    options: {
      url: "redis://[redis_endpoint]",
    },
  });
  1. Try to run app
    Log output:

[Nest] 77969   - 04/14/2019, 12:27 PM   [NestFactory] Starting Nest application...
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] TypeOrmModule dependencies initialized +134ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] PassportModule dependencies initialized +1ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] ClientsModule dependencies initialized +2ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] JwtModule dependencies initialized +2ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] TypeOrmCoreModule dependencies initialized +548ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] TypeOrmModule dependencies initialized +2ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] TypeOrmModule dependencies initialized +35ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] TypeOrmModule dependencies initialized +9ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] TypeOrmModule dependencies initialized +4ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] TypeOrmModule dependencies initialized +2ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] TypeOrmModule dependencies initialized +2ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] TypeOrmModule dependencies initialized +14ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] TypeOrmModule dependencies initialized +3ms
[Nest] 77969   - 04/14/2019, 12:27 PM   [InstanceLoader] CategoriesModule dependencies initialized +11ms
[.... other modules ...]
[Nest] 77969   - 04/14/2019, 12:27 PM   [NestMicroservice] Nest microservice successfully started +332ms

Then app logs looks like freezed - no "Nest application successfully started" information, application doesn't respond to requests.

Environment


Nest version: 6.1.0


For Tooling issues:
- Node version: 10  
- Platform:  linux 

Others:

question 馃檶

All 4 comments

Not sure how we can help you with this issue honestly. It sounds rather like a devops problem.

AFAIK AWS does not expose ports by default. You need to expose the 6379 port and secure your redis configuration with username/password. To make sure whether you exposed connection properly, you can try to open a telnet connection.

Just a note, although this is definitely offtopic for this project: you cannot connect to ElasticCache outside of AWS. That means that you cannot use Redis ElasticCache in local, or non AWS hosted projects. AWS will only permit connects to ElasticCache from other AWS machines.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings