Trying to complete the 'Access Salesforce Data with Lightning Web Components Open Source ==> Connect To Salesforce' trailhead module. I have created a .env file and have copied the connection code in index.js file. However, I am getting an error in


process is not defined.

Can someone help?

  • 2
    Are you running this in the correct environment? You can't use process in a normal web browser environment, but instead need to be using NodeJS. – sfdcfox Oct 13 '19 at 0:47
  • yea, i believe I am using the correct environment. I have also installed the dotenv module and have create the .env file – Kaustubh Labhe Oct 13 '19 at 15:44

I also faced the same issue. It was a typo from my end. Make sure, .env file is correctly named and is not .env.text.

Regards, Raj

| improve this answer | |

I had the same issue. what I found out is that three things one can run into.

  1. The .env file has to be in the correct name format vscode will give it a .txt extension so rename it to delete the .txt

  2. When you reset the token for some reason it does it twice and you get two emails use the token in the last email you get. 

  3. Most importantly, if you are having issues with connection and are making changes to the .env file you want to make sure you are not running the app. So use ctrl+C and enter Y for yes to quit the watch. make your changes to the .env file. CLOSE Vscode completely and then do your npm run watch. 

| improve this answer | |

I had the same issue, it would be better to check .env, credentials first. But, if you are still facing the issue then it would be possible that the process is failing. For example, in my api.js file I have a get method, for SOQL:


app.get('/api/sessions', (req, res) => {
    const soql = `SELECT Id, Name, toLabel(Room__c), Description__c, format(Date_and_Time__c) formattedDateTime,
        (SELECT Speaker__r.Id, Speaker__r.Name, Speaker__r.Description, Speaker__r.Email, Speaker__r.Picture_URL__c FROM Session_Speakers__r)
        FROM Session__c ORDER BY Date_and_Time__c LIMIT 100`;
        conn.query(soql, (err, result) => {
            console.log('err: '+ err);


and when I did console.log('err: '+ err); to check the error I found the root cause that the field API name is wrong.

Speaker__r.Id, Speaker__r.Name, Speaker__r.Description, Speaker__r.Email                                ^
ERROR at Row:2:Column:49
No such column 'Description' on entity 'Speaker__c'. If you are attempting to use a custom field, be sure to append the '__c' 
after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

you may also check by doing something like this.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.