thrift icon indicating copy to clipboard operation
thrift copied to clipboard

Use `outputVar` instead of hard coding `this.output` in JS codegen

Open ben-harris-5 opened this issue 1 year ago • 2 comments

When generating the JS Thrift clients, it hard-codes this.output in a few places; however, if gen_node_ is true, our variable should be output instead. We set a variable, outputVar, up on line 1968/1970 of the file, but don't use it everywhere. In NodeJS environment, this can lead to the wrong flush being called, which can lead to issues; for example, with the header transport protocol, the headers can either go missing or be sent incorrectly.

I believe this is a trivial change not requiring a ticket.

  • [ ] Did you create an Apache Jira ticket? (Request account here, not required for trivial changes)
  • [ ] ~If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?~
  • [x] Did you squash your changes to a single commit? (not required, but preferred)
  • [x] Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • [ ] ~If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.~

ben-harris-5 avatar Mar 22 '24 16:03 ben-harris-5

CI is failing for this, but I'm incredibly unsure why or what's going wrong here. I'd greatly appreciate any assistance that folks could provide on this!

EDIT: Yeah, Java's failing, but this doesn't touch the Java code o_o

ben-harris-5 avatar Mar 22 '24 18:03 ben-harris-5

Please:

  1. Create a JIRA ticket to describe the issue (with what's the current generated code and what should be the correct code)
  2. Resolve the merge conflicts (java failing should be fixed on latest master version)
  3. Create an unit test under lib/nodejs/test/ (or maybe lib/js/test/?) to verify this fix

fishy avatar Apr 24 '24 22:04 fishy