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

Partial omission of emitted object if jsonification fails #5225

Open
eldir opened this issue Nov 12, 2024 · 2 comments
Open

Partial omission of emitted object if jsonification fails #5225

eldir opened this issue Nov 12, 2024 · 2 comments
Labels
to triage Waiting to be triaged by a member of the team

Comments

@eldir
Copy link

eldir commented Nov 12, 2024

Describe the bug
When passing an object to an emit that contains a function reference it just quietly gets omitted.

To Reproduce

function test_function() {
  return null;
}

const data = {
  key_one: "value 1",
  key_two: test_function
}

socket.emit("test", data);

Checking traffic will show that test gets a message containing only

{
  "key_one": "value 1"
}

With no error or even warning on the console.

Expected behavior
If jsonification fails (which is what I suspect is happening here) I would expect at least a warning or a full transmission failure and not quiet removal of part of the transmitted object.

Platform:

  • Device: PC
  • OS: Ubuntu 24.04.1 LTS
  • tested on socket.io client 4.7.5 and 4.8.1

Additional context
For context we initially found this with a misconfigured value from redux. A console.log(data) will produce the full object as expected.

@eldir eldir added the to triage Waiting to be triaged by a member of the team label Nov 12, 2024
@eldir
Copy link
Author

eldir commented Nov 12, 2024

Closing this here as I should have posted this in the client repo.

@eldir eldir closed this as completed Nov 12, 2024
@eldir
Copy link
Author

eldir commented Nov 13, 2024

@eldir eldir reopened this Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to triage Waiting to be triaged by a member of the team
Projects
None yet
Development

No branches or pull requests

1 participant