I am calling lwc method from aura. It gives me error: Cannot read properties of undefined (reading 'then')]. Here is my code. There were some complex logic, but it gives the same error with just returning true;

export default class LwcComponent extends LightningElement {

    @api lwcMethod() {
        return  true; //changed to "return Promise.resolve(true)";


    <aura:handler name="init"
    <c:LwcComponent  aura:id="lwcComponent"/>


    onInit: function (component, event, helper) {

    doInit: function (component) {

            .then($A.getCallback(function (response) {

UPD:I debugged and it seems that method even is not called

  • It needs to return a Promise for .then to work.
    – Adrian Larson
    Commented Nov 11, 2022 at 14:21
  • @AdrianLarson I tried with promise.resolve and got the same error.
    – Jobaf
    Commented Nov 11, 2022 at 14:42

1 Answer 1


Have you tried this? https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.interop_share_javascript

Also here are some communications patterns: https://developer.salesforce.com/blogs/2021/05/inter-component-communication-patterns-for-lightning-web-components

I know these references are saying about data communication, but if we think a little, on javascript a function that could be passed through it,


  1. Does your component.find('lwcComponent') is returning the element from the DOM?
  2. Which event is not being called? the doInit?
  • 1. Yes. 2.lwcMethod. I added console.log and tin debud there are no entry at that point. But function is correct, because I tried with wrong one and there are another error. I will look into first link, thanks.
    – Jobaf
    Commented Nov 11, 2022 at 17:40

You must log in to answer this question.

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