Closed craig-willis closed 4 years ago
Looking at the js code:
and how that code is executed, jobId
never makes it outside the if
statement. I had var jobId
there initially, instead of let jobId
, but I was suggested to change it https://github.com/whole-tale/dashboard/pull/592#discussion_r380808841 @bodom0015 is there something I'm doing wrong there?
@Xarthisius kind of moot now since you got it working, but for completeness' sake:
Yes, this was the exact same problem as https://github.com/whole-tale/dashboard/pull/595#discussion_r380838395 - sorry that I missed it during the first review cycle
You can't declare a variable in an if
statement and expect to use it outside of the if
scope. This is true for any programming language that provides block-level scoping (Python does not). Changing to let
is what caused it to actually throw an error when the variable goes out of scope, whereas var
would have just tried to guess what you were trying to do.
You instead have to declare it outside the if
block (at the scope which you plan on using it), and assign it a value inside the if
block.
Build: v0.9rc2-2-gc9c4b5e tested on staging
Problem: During image build, view logs fails with
ReferenceError: jobId is not defined
To repeat:
Expected behavior:
Actual behavior: