Skip to content
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

Unable to use URL in ioredis cache options #7631

Closed
2 of 22 tasks
JoeCap08055 opened this issue May 7, 2021 · 2 comments · Fixed by #7689
Closed
2 of 22 tasks

Unable to use URL in ioredis cache options #7631

JoeCap08055 opened this issue May 7, 2021 · 2 comments · Fixed by #7689

Comments

@JoeCap08055
Copy link
Contributor

Issue Description

According to the ioredis docs, the following connection options are equivalent within the cache {} block:

cache {
  type: "ioredis",
  options {
     port: 1234,
     host: "myhost",
     db: 1
  }
}
cache {
   type: "ioredis",
   port: 1234,
   options {
      host: "myhost",
      db: 1
   }
}
cache {
   type: "ioredis",
   port: "redis://myhost:1234/1"
}

Expected Behavior

All three config options above produce the same result, which is an ioredis query cache connected to myhost on port 1234, database index 1

Actual Behavior

Option 1 succeeds.
Option 2 ignores port and only uses the values inside the options block, using the ioredis default port 6379. Connection fails.
Option 3 ignores port and attempts to connect to localhost:6379, and fails.

Steps to Reproduce

Try each of the listed cache configs in your ormconfig.js

My Environment

Dependency Version
Operating System
Node.js version v14.16.1
Typescript version v3.9.9
TypeORM version v0.2.32
ioredis version v4.27.2

Additional Context

Relevant Database Driver(s)

  • aurora-data-api
  • aurora-data-api-pg
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • ioredis
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

I've made a fix & tested locally. Just need guidance with the pull request.

  • Yes, I have the time, and I know how to start.
  • Yes, I have the time, but I don't know how to start. I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.
@JoeCap08055
Copy link
Contributor Author

I have a pull request ready to submit, but I don't have permission to push my branch

AlexMesser pushed a commit that referenced this issue May 29, 2021
According to the ioredis documentation, a URL may be passed in the 'port' parameter.
    This does not currently work when using an ioredis cache. Modify ioredis connection logic
    to conform to ioredis standards.

    Closes: #7631

Co-authored-by: Joe Caputo <joseph.caputo@atomyze.us>
@Esqarrouth
Copy link

Does this only work in ioredis?
What about normal redis?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants