I have experience site page in which i have included the LWC component. LWC component displays the contact information related to the logged in user. I have given the access to the appropriate profiles.

Here is an error which i am getting into the browser console. enter image description here

Here is the glimpse of my code LWC JS

import { LightningElement, api, track } from 'lwc'; 
    import fetchContactInfo from 
import updateContactInfo from '@salesforce/apex/NQHProfileController.updateContactInfo';
        fetchMemberDetails() {
              .then(result => {
                const dataResult = JSON.stringify(result);
                console.log("RESULT-->" + JSON.stringify(result));
                if (result) {
                                console.log('in result====>',result);
                  this.memberDetails = {
                    contactId: dataResult.ContactId, 
                    name: dataResult.FirstName + ' ' + dataResult.LastName,
                    email: dataResult.Email,
                    phone: dataResult.Phone,
                    address: {
                      street: dataResult.MailingAddress.street,
                      city: dataResult.MailingAddress.city,
                      state: dataResult.MailingAddress.state,
                      postal: dataResult.MailingAddress.postalCode
                } else {
                  console.error('No contact information found');
              .catch(error => {
                console.error('Error fetching contact information', error);
              });   }

  • What's does the error say? Commented Feb 7 at 8:50
  • error doesn't say anything specific to it Commented Feb 7 at 8:53

1 Answer 1

const dataResult = JSON.stringify(result);

You're converting the data into a string, then trying to use that string to access properties that definitely don't exist on a string (e.g. dataResult.MailingAddress.street). Do not convert the result to JSON.

If you're having a problem reading the data in the console (e.g. console.log('in result====>',result); shows Proxy), just know that the Proxy is transparent to the running code. It's used to implement a read-only property on the data result.

You must log in to answer this question.

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