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

[Bug]: Get "Invalid Cluster Cursor Format" error when scanning if node name contains hyphen #2865

Closed
tf-nphillips opened this issue Dec 13, 2023 · 2 comments
Labels
issue Something isn't working

Comments

@tf-nphillips
Copy link
Contributor

Preconditions
Redis cluster where node host names contain one or more hyphens (ie myredis-0002-001)
Note that AWS Elasticache Redis instances with cluster mode enabled use hyphens in the shard/node names.

Steps to reproduce

  1. Connect to Redis cluster that contains node names with hyphens in them
  2. Click "Scan more" after initial list of keys appears
  3. Get "Invalid Cluster Cursor Format" error message

Actual behavior
The "Scan more" functionality posts a keys command to backend:

POST http://localhost:5000/api/databases/{guid}/keys?encoding=buffer

{
	"cursor": "myredis-cme-0002-001.myredis-cme.redishost.com:6379@26230||myredis-cme-0001-001.myredis-cme.redishost.com:6379@16950",
	"count": 10000,
	"type": null,
	"match": "*",
	"keysInfo": false
}

The backend returns a 500 error:

{
	"statusCode": 500,
	"message": "Incorrect cluster cursor format.",
	"error": "Internal Server Error"
}

The front end displays the "Incorrect cluster cursor format" error message and does not return more keys matching the specified pattern

Expected behavior
The "Scan more" functionality posts keys command to backend where node names containing hyphens pass the CLUSTER_CURSOR_REGEX test, parseClusterCursor(...) does not throw and api request properly returns more keys from the cursor which are displayed in front end.

Changing the CLUSTER_CURSOR_REGEX to account for hyphens in node names allows for the expected behavior above:

const CLUSTER_CURSOR_REGEX = /^(([a-z0-9.-])+:[0-9]+(@-?\d+)(?:\|{2}(?!$)|$))+$/;

@tf-nphillips tf-nphillips added the issue Something isn't working label Dec 13, 2023
@ViktarStarastsenka
Copy link
Collaborator

hi @tf-nphillips , thanks for reporting the issue and adding the fix.
it will be available with 2.40 in late December

@ViktarStarastsenka
Copy link
Collaborator

2.40 has been released today.
Please re-open the ticket if the issue still persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants