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

Fix #253 Cannot read property 'then' of null in Transport.js issue. #254

Conversation

alexrayan
Copy link

@alexrayan alexrayan commented Jun 14, 2022

Description

Porting a fix for "Cannot read property 'then' of null in Transport.js issue".
based on the original fix for the same issue in elastic/elasticsearch-js client lib here: elastic/elasticsearch-js#1594

Issues Resolved

Fix #253

Check List

  • All tests pass
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@alexrayan alexrayan requested a review from a team as a code owner June 14, 2022 05:36
@alexrayan alexrayan force-pushed the bugfix/then_on_null_in_transport_error_fix branch from e7b54f4 to b863344 Compare June 14, 2022 05:39
@ananzh
Copy link
Member

ananzh commented Jun 17, 2022

Trying to reproduce and verify the fix here, do see the issue. Here is the detail .

Copy link
Member

@ananzh ananzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, just one minor issue

}
})

test('Issue #1521 with callbacks', t => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1521 --> #253

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ananzh Updated! Thank you :)
Sorry for the delay with the response. I am able to see the test failing on "Issue #253 with callbacks" in my local without the code change and the test passing with the code fix.
We actually encountered this issue in our own production flow which is using callbacks when we switched to ES version 7 from ES version 5.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Not a problem. I think making lib more robust is a must. Meanwhile I do see error msg from unit tests. Thanks for the contribution.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, hopefully I can contribute more if time permits. Looks like a lot of people are moving towards the open source distribution of the ES.
Do you see any other error msgs in the unit tests? All the tests are passing on my branch. Or did you mean that the null type error is triggering in unit tests without the fix in place?
Would love to merge this fix to the opensearch-project main repo and switch off of our fork. :)

@alexrayan alexrayan force-pushed the bugfix/then_on_null_in_transport_error_fix branch from 59263f5 to 19a431b Compare June 20, 2022 19:33
Copy link
Member

@ananzh ananzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice~

@rawpixel-vincent
Copy link
Contributor

this fix our issue where the opensearch client is throwing errors on every requests

@alexrayan
Copy link
Author

@ananzh Are these any plans to merge this PR to the code base? Looks like it requires more than 1 approval

Copy link
Member

@kavilla kavilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @alexrayan,

Thanks for doing this! The changes look good but one thing to note is that it would appear the code is copied from the fork after the licensing change.

For the source code there isn't much you can but the tests has references to Elasticsearch. Could we clean up these tests to avoid any issues with licensing.

Thank you again!

@alexrayan
Copy link
Author

Hello @alexrayan,

Thanks for doing this! The changes look good but one thing to note is that it would appear the code is copied from the fork after the licensing change.

For the source code there isn't much you can but the tests has references to Elasticsearch. Could we clean up these tests to avoid any issues with licensing.

Thank you again!

Hi @kavilla! Sure, let me cleanup the tests and remove the refs shortly.

@dblock
Copy link
Member

dblock commented Aug 26, 2022

@alexrayan Want to finish this?

@rawpixel-vincent
Copy link
Contributor

@alexrayan thanks for this 🙏🏻

cleaned up the unit tests

alexrayan#3

Screen Shot 2022-08-27 at 04 52 29

@rawpixel-vincent
Copy link
Contributor

if that helps I rebased the commits to remove any ref to the elasticsearch codebase in #283

@alexrayan
Copy link
Author

@rawpixel-vincent Thank you for that! Appreciate it. Apologies for the delay. Life and work got in the way so wasn't able to find time to clean up the tests to remove the ES references.

@alexrayan
Copy link
Author

Implemented with the following PR https://github.com/opensearch-project/opensearch-js/pull/283/files, so closing mine.

@alexrayan alexrayan closed this Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] "Cannot read property 'then' of null" in Transport.js
5 participants