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

Misconfigurations in outbound push config result in unexpected behavior. #9747

Open
witash opened this issue Jan 16, 2025 · 1 comment · May be fixed by #9748
Open

Misconfigurations in outbound push config result in unexpected behavior. #9747

witash opened this issue Jan 16, 2025 · 1 comment · May be fixed by #9748
Assignees
Labels
Type: Bug Fix something that isn't working as intended
Milestone

Comments

@witash
Copy link

witash commented Jan 16, 2025

Describe the bug
Misconfigurations in outbound push config result in unexpected behavior.
If a mapping value does not have type "string" and is not an Object with a property "expr", this is a misconfiguration; it is not defined what the mapping should do.
What it actually does is include the entire document in the mapped field in the payload.

To Reproduce

  1. create an outbound push config with a mapping field that is neither a string nor an Object with property "expr", e.g.
...
"outbound": {
    "relevant_to": "doc.type == 'data_record'",
    "mapping": {
        "example_path": {
            "not_expr": "[{ \"example\": doc.phone }]",
            "optional": true
        }
    }
}
  1. create any document that will trigger the outbound push (any report with the example above)
  2. Look at the mapped field in the outbound push body ("example_path" in the example above); if will contain the entire document

Expected behavior
If the configuration has a mapping value that is undefined, mapping should raise error OutboundError(Mapping error for '${key}/${dest}' JS error on source document: '${doc._id}': ${err}); similar to what happens with other config misconfigurations.
This alerts users to fix the configuration instead of allowing the outbound push to silently continue with a payload that is probably not what they intended.

@witash witash added the Type: Bug Fix something that isn't working as intended label Jan 16, 2025
@witash witash self-assigned this Jan 16, 2025
@mrjones-plip
Copy link
Contributor

Thanks so much for chasing this down Diana! Do you know what versions this applies to?

witash added a commit that referenced this issue Jan 20, 2025
@andrablaj andrablaj added this to the 4.17.0 milestone Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Fix something that isn't working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants