I have a recursive helper function that checks every 5 seconds for the status of a queueable job.

Upon the first recursive call, the helper method throws Uncaught Error in $A.getCallback() [component.get is not a function]

The helper function:

checkUploadStatus: function(component, event, helper, jobId, cdId) {
    let action = component.get('c.checkUploadJobStatus');
    action.setParams({'jobId': jobId, 'cdId': cdId});
    action.setCallback(this, function(response) {
        let state = response.getState();
        if (state === "SUCCESS") {
            let returnVal = response.getReturnValue();
            console.log('returnVal', returnVal);
            if (returnVal === null) {
                    $A.getCallback(helper.checkUploadStatus.bind(component, helper, jobId, cdId)),
            } else {
                // do work
        } else {
            // handle error

How come component is not recognized?

2 Answers 2


You can simply move it to callback logic, no need to bind, arrow functions make this easier.

action.setCallback(this, (response) => {
            if (response.getState() === "SUCCESS") {
                        $A.getCallback(() => {
                            this.checkUploadStatus(comp, event, helper);

Notice two changes,

  1. setCallback to arrow function so this inside still refers to helper.
  2. getCallback, bind to a comparatively simpler call with arrow functions.
  • 1
    thanks! i actually didn't notice the first change, so i only changed the setTimeout's function to arrow function and it worked. what does using arrow functions do exactly instead of a regular function(reponse) {}? May 29, 2021 at 14:45
  • 1
    You can use this instead of writing helper everytime in the callback. The way i used this to call checkUploadStatus instead of helper :) If you use arrow fn in callback. May 29, 2021 at 14:47

The first element to bind sets the this context:

$A.getCallback(helper.checkUploadStatus.bind(this, component, helper, jobId, cdId);

Since the first parameter was the component, it became this, and your helper became component, etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .