Saturday 30 May 2020

Integration Errors & Fixes


1.error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration
Updated connected app callback URL with the callback URL from Auth provider.

2.We can't authorize you because of an OAuth error. For more information, contact your Salesforce administrator. 1800 : There was a problem in setting up your remote access
Log off all the open source and target orgs and try to authenticate again.

Scenario :
If any changes in Auth Provider,When you try to save named credentials with latest changes while authenticating you may get this error if the target org is already open.

3.The authentication provider didn't provide a refresh token. If the access token expires, your org won't be able to access this named credential.
Go To --> Authentication Provider --> Default Scopes - Provide value [refresh_token full]in this and save and save Named Credentials

4.System.HttpResponse[Status=Unauthorized, StatusCode=401]
Authentication Status in Named credentials should be Authenticated for the Target org user [Integration user]
Verify the credentials.


Friday 29 May 2020

Lightning Web Components Errors & Fixes

1. SFDX: Create Project.

Error :
09:47:54.651 sfdx force:project:create --projectname
HelloWorldLightningWebComponent --outputdir c:\LWC --template standard
ERROR running force:project:create:  Command failed with
exit code 1: npm root -g --prefix c:\LWC\.yo-repository --loglevel error
'npm' is not recognized as an internal or external command,
operable program or batch file.
09:47:57.138 sfdx force:project:create --projectname
HelloWorldLightningWebComponent --outputdir c:\LWC --template standard
 ended with exit code 1

Fix : Update the CLI
VS Code --> Terminal --> SFDX Update

2. SFDX: Update
Error :  Channel "stable" not found.
Fix : Close the visual studio and open again try to execute the command,It solved for me.

3. SFDX: Scratch Org Creation
Error :  running force:org:create:  Error authenticating with the refresh token due to:                   expired access/refresh token
Fix : First Authenticate the Dev Hub login & Then try to create scratch org
sfdx force:auth:web:login -d -a DevHub sfdx force:org:create -d 30 -s -a eslwc -f config/project-scratch-def.json

4. Handling Server Errors Example Implementation

Error :  No Module named markup://c:ldsUtils found :[markup://c:accountList]

Fix :      First deploy the “ldsUtils” to source org and then try to deploy “accountList”

5. Set Up Jest Testing Framework
Error : npm ERR! request to https://registry.npmjs.org/@salesforce%2fsfdx-lwc-jest failed, reason: self signed certificate in certificate chain
while executing "sfdx force:lightning:lwc:test:setup"
Fix : Execute below command 1st
npm config set strict-ssl false

5. How to retrieve component from Salesforce to Visual Studio ?
Ex: Retrieve boatMap component from Salesforce to VS
sfdx force:source:retrieve -m LightningComponentBundle:boatMap

To get project specific :

sfdx force:source:retrieve -p C:\LWC\BoatSearch-LWC-SP\force-app\main\default\lwc -u vscodeOrg


To get all the LWC comp :

sfdx force:source:retrieve -m LightningWebComponentBundle