This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-CC3235S: aws_iot_shadow_get() Doesn't call callback - - thing/shadow/get/accepted IS Firing

Part Number: LAUNCHXL-CC3235S

Hey Everyone.

I am seeking guidance for another AWS issue. 

I have had success publishing, subscribing, and updating, but GETting has been a challenge. I am setting breakpoints in my callback function, and they are never being hit.
My understanding is that this function gets called for Success or Failure, but it's not firing. What Exactly are the conditions that call the Callback? I don't see anything in the AWS Plugin Docs.

My thing/shadow/get/accepted Topic IS Publishing. The problem is that I'm unable to capture it into my Microcontroller.


I also can tell you that my AWS Iot Core / Thing policies are not the problem. I have set my permissions as loose as possible. Notice how the statement for GET is identical to UPDATE, which I have confirmed to work.


I have Confirmed that the client IS Subscribing to the /shadow/get/rejected + /accepted topics.

Also, I have noticed that my timeout seconds argument for the GET function doesn't matter. The function seems to hang for 2 seconds regardless of the actual argument value passed, which I believe is the time given to make sure both Subscribe actions are complete.

I have tried:
 - Adding aws_iot_shadow_yield() / aws_iot_mqtt_yield() after my GET function
 - Different timeouts
 - Setting persistent subscribe argument to true and false
 - Adjusting permissions then reverting them back to what I showed above (known good)

The Return Code (rcGS) always returns SUCCESS for all my other aws functions within this routine, and during the get function I have confirmed that the client IS Connected to AWS.

My GET Function:

IoT_Error_t rcGS;

rcGS = aws_iot_shadow_get(&client, AWS_IOT_MY_THING_NAME, getShadowCallback, NULL, 5, true);



My GET function Callback:

static void getShadowCallback(const char *pThingName, ShadowActions_t action, Shadow_Ack_Status_t status,
        const char *pReceivedJsonDocument, void *pContextData){

    IOT_UNUSED(action);
    IOT_UNUSED(pContextData);
    IOT_UNUSED(pReceivedJsonDocument);
    IOT_UNUSED(pThingName);
    
    nop; // breakpoint

    if (SHADOW_ACK_TIMEOUT == status) {
        IOT_INFO("GET Timeout--");
    } else if (SHADOW_ACK_REJECTED == status) {
        IOT_INFO("GET RejectedXX");
    } else if (SHADOW_ACK_ACCEPTED == status) {
        IOT_INFO("GET Accepted !!");
        GetFromAWS = true;
    }else{
        IOT_INFO("Unknown Update Status");
    }

}

I have tried to troubleshoot this for several hours before asking for help. I do appreciate any help, and I'm sure others have and will run into this as well. Thank you

  • The aws_iot_shadow_get subscribes (the Action Ack: SHADOW_ACCEPTED/REJECTED) and then publishes (the Action Request). 

    If both the publish and subscribe operations are working - then this should work.

    It is hard for us to tell what gone wrong.

    The aws_iot_shadow module is part of the AWS' C SDK (which we just ported to use CC32xx).

    Please check in the AWS forums what can be the issue. Having the subscription parameters and the "IOT Thing" configuration you have - they should be able to help.

  • Thank you. I'll give that a shot.

  • I don't know how I missed this, but even after combing over AWS policy statements for days, I completely missed the "Receive" action. I succeeded with Connect, Publish, Subscribe, GET, and UPDATE, but I completely overlooked Receive.

    I feel a bit silly, but that was my problem. I enabled Receiving, and all is well. 

    Also, make sure you call your YIELD function after your Get / Update / Delete. This will trigger your callback for Accepted / Rejected message.

    Check your permissions Everyone! Iot Core policies have caused 80% of my issues on this entire project.