Skip to content

Commit

Permalink
fix(Code Node): Bind helper methods to the correct context (#9380)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed May 16, 2024
1 parent bdb572c commit a515686
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/nodes-base/nodes/Code/Sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@ export interface SandboxContext extends IWorkflowDataProxyData {
export const REQUIRED_N8N_ITEM_KEYS = new Set(['json', 'binary', 'pairedItem', 'error']);

export function getSandboxContext(this: IExecuteFunctions, index: number): SandboxContext {
const helpers = {
...this.helpers,
httpRequestWithAuthentication: this.helpers.httpRequestWithAuthentication.bind(this),
requestWithAuthenticationPaginated: this.helpers.requestWithAuthenticationPaginated.bind(this),
};
return {
// from NodeExecuteFunctions
$getNodeParameter: this.getNodeParameter,
$getWorkflowStaticData: this.getWorkflowStaticData,
helpers: this.helpers,
helpers,

// to bring in all $-prefixed vars and methods from WorkflowDataProxy
// $node, $items(), $parameter, $json, $env, etc.
Expand Down

0 comments on commit a515686

Please sign in to comment.