Fix null prototypes breaking the logger #618
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where an object with a null prototype causes the logger to blow up.
This in turn fixes
bulk
in thesalesforce
adaptor in the worker.Related issue
Fixes #616
Implementation Details
The fundamental problem is is that this code throws an error:
It just so happened that the Salesforce adaptor was triggering this exception because the logger calls
isNaN
on any console.logged values.The fix is to do
typeof x === 'number'
instead, which feels much more robust for our purposes.QA Notes
I've been testing on the SF sandbox with job:
The same code is in a new unit test in
ws-worker/test/worker.test.ts
. I've disabled the test for CI but I think the pattern is useful to keep, so I'm keeping it.Checklist before requesting a review
Release branch checklist
Delete this section if this is not a release PR.
If this IS a release branch:
pnpm changeset
from root to bump versionspnpm install
pnpm changeset tag
to generate tagsgit push --tags
Tags may need updating if commits come in after the tags are first generated.