<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126221/disconnect-reconnect-loop-when-shadow-messages-are-larger-than-modem-2k-tls-buffer</link><description>Hi, 
 We&amp;#39;re aware of the modem 2K TLS buffer limitation. It&amp;#39;s causing us quite a bit of headache related to the device shadow. 
 Our application needs a number of config parameters in the shadow, but even with space-saving measures (short property keys</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 26 Feb 2026 11:27:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126221/disconnect-reconnect-loop-when-shadow-messages-are-larger-than-modem-2k-tls-buffer" /><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/562131?ContentTypeID=1</link><pubDate>Thu, 26 Feb 2026 11:27:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89bc6ae3-c89a-455b-8c28-d50a315d9eae</guid><dc:creator>Pascal Hdz</dc:creator><description>&lt;p&gt;&lt;span style="font-size:150%;"&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;div data-ogsc="black" data-olk-copy-source="MessageBody"&gt;We&amp;#39;ve just integrated into NCS&amp;nbsp;the fix that resolves the issue with device shadows using MQTT. This implementation is a continuation of the first fix I shared.&lt;/div&gt;
&lt;div data-ogsc="black"&gt;&lt;/div&gt;
&lt;div data-ogsc="black"&gt;&lt;a id="OWA7a0f1276-5036-77eb-26b4-d8cbf47ddf96" title="https://github.com/nrfconnect/sdk-nrf/pull/27015" href="https://github.com/nrfconnect/sdk-nrf/pull/27015" rel="noopener noreferrer" target="_blank" data-auth="NotApplicable" data-linkindex="0" data-ogsc=""&gt;https://github.com/nrfconnect/sdk-nrf/pull/27015&lt;/a&gt;&lt;/div&gt;
&lt;div data-ogsc="black"&gt;&lt;/div&gt;
&lt;div data-ogsc="black"&gt;On the nRF Cloud side, the delta update will no longer allow sending payloads larger than 1792 bytes. If the resulting delta exceeds this limit, an error will be posted in the following topics:&lt;/div&gt;
&lt;div data-ogsc="black"&gt;&lt;/div&gt;
&lt;div data-ogsc="black"&gt;&lt;b data-ogsc=""&gt;- /shadow/update/delta/trim/err&lt;/b&gt;&lt;/div&gt;
&lt;div data-ogsc="black"&gt;&lt;b data-ogsc=""&gt;- /shadow/update/delta/full/err&lt;/b&gt;&lt;/div&gt;
&lt;div data-ogsc="black"&gt;&lt;/div&gt;
&lt;div data-ogsc="black"&gt;To prioritize nRF Cloud sending the maximum number of shadow updates, the MQTT library in NCS is configured by default to use&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b data-ogsc=""&gt;/shadow/update/delta/trim&lt;/b&gt;&amp;nbsp;and its corresponding error topic.&lt;/div&gt;
&lt;div data-ogsc="black"&gt;&lt;/div&gt;
&lt;div data-ogsc="black"&gt;If you wish to request the status of a shadow value, we recommend doing so through Transform and its&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b data-ogsc=""&gt;/shadow/get/tf&lt;/b&gt;&amp;nbsp;topic. The response will be received via&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b data-ogsc=""&gt;/shadow/get/accepted/tf&lt;/b&gt;. Transform has the feature of sharing the payload size limit for the response, which is set to 1792 bytes by default. If the response exceeds this limit, nRF Cloud will publish an error message in&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b data-ogsc=""&gt;/shadow/get/accepted/tf&lt;/b&gt;.&lt;/div&gt;
&lt;div data-ogsc="black"&gt;&lt;/div&gt;
&lt;div data-ogsc="black"&gt;In the same pull request, the samples that used MQTT device shadow were updated and can be used as a reference.&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/559759?ContentTypeID=1</link><pubDate>Wed, 28 Jan 2026 09:14:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:caaeec83-4c16-4895-8f23-03ddf61fbd6e</guid><dc:creator>Pascal Hdz</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;For future reference, requesting the device shadow using `/trim` has the limitation that the nRF91 device&amp;#39;s modem cannot handle the payload (limited to 2KB). This causes a socket error and terminates the connection, leading to the issue reported here. To avoid this problem, adjustments were made to the MQTT library, using `transform` to optimize data transmission since it uses JSONata. This functionality already existed but was not being used for connection initialization. The change was implemented in the following pull request:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/pull/26667"&gt;github.com/.../26667&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Enabling `CONFIG_NRF_CLOUD_MQTT_SHADOW_TRANSFORMS` in your project enables this functionality.&lt;/p&gt;
&lt;p&gt;Pascal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/559172?ContentTypeID=1</link><pubDate>Tue, 20 Jan 2026 13:56:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:963abc97-6d4b-41be-b67b-856d169c692e</guid><dc:creator>Pascal Hdz</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I would like to discuss more in detail parts of your application and device shadow usage. I sent you an email.&lt;br /&gt;Pascal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/559044?ContentTypeID=1</link><pubDate>Mon, 19 Jan 2026 14:10:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f315fc0-d59f-431c-828c-440c011d3018</guid><dc:creator>teba99</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/pascal-hdz"&gt;Pascal Hdz&lt;/a&gt;&amp;nbsp;.&lt;/p&gt;
&lt;p&gt;Thank you for the update. As mentioned, we already have significantly reduced the size of our shadow, and in normal operation&amp;nbsp;that works for us. &lt;br /&gt;&lt;br /&gt;The problem&amp;nbsp;is that it that the current system is&amp;nbsp;quite brittle and doesn&amp;#39;t handle shadow changes very robustly, even when the shadows themselves are smaller than 2k. For example, we had a bug in our&amp;nbsp;cloud&amp;nbsp;application where incorrect&amp;nbsp;updates were written to &amp;quot;desired&amp;quot; (via nRF Cloud API). This caused shadow deltas larger than 2k, immediately forcing&amp;nbsp;a large number of devices into the disconnect/reconnect loop. There are&amp;nbsp;several other situations where accidental shadow&amp;nbsp;operations can force devices offline.&lt;br /&gt;&lt;br /&gt;Looking forward to your approach&amp;nbsp;to address this in nRF Cloud.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/558878?ContentTypeID=1</link><pubDate>Fri, 16 Jan 2026 11:37:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6367de6-f8f9-43c3-8b0f-e0a779cb2d32</guid><dc:creator>Pascal Hdz</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank you for your patience. We&amp;#39;ve been investigating ways to resolve this issue and believe the only solution is through nRF Cloud. Since the modem&amp;#39;s 2KB limit is unchangeable, we ask that you find a way to adjust your Shadow update to a smaller size. We will work to limit this through nRF Cloud in the future to prevent messages larger than the modem can handle from being posted to the topic. &lt;a href="https://docs.nordicsemi.com/bundle/nrf-cloud/page/APIs/MQTT/Topics.html#shadow-topics"&gt;Our documentation&lt;/a&gt; already explains this, but we believe it would be better to prevent this connection/disconnection cycle through nRF Cloud.&lt;/p&gt;
&lt;p&gt;Pascal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/558481?ContentTypeID=1</link><pubDate>Mon, 12 Jan 2026 09:22:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c13482e3-e9ab-4917-924d-50a63e9d8a08</guid><dc:creator>teba99</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Excellent, thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/558480?ContentTypeID=1</link><pubDate>Mon, 12 Jan 2026 09:20:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dad63d7b-0f7c-462c-a48e-060fcd2acb58</guid><dc:creator>Pascal Hdz</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I was able to reproduce the issue. We are investigating a solution, I will contact you as soon we know something.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Pascal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/558413?ContentTypeID=1</link><pubDate>Fri, 09 Jan 2026 14:45:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea55c988-8a64-4eef-9331-53578fd95e57</guid><dc:creator>teba99</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Ok, logLvl, I see. Thanks.&lt;/p&gt;
&lt;p&gt;As I mentioned, you have to change several properties in desired at once to trigger this.&lt;/p&gt;
&lt;p&gt;You can use any method to update &amp;quot;desired&amp;quot;, for example the nRF Cloud UI &amp;quot;View Config&amp;quot; functionality. There, in the &amp;quot;desired&amp;quot; change&amp;nbsp;a number of properties, for example 10 properties with 4 key/value-pairs each:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        &amp;quot;config&amp;quot;: {
            &amp;quot;cfg&amp;quot;: {
                &amp;quot;property0&amp;quot;: {
                    &amp;quot;property0-key1&amp;quot;: &amp;quot;value11&amp;quot;,
                    &amp;quot;property0-key2&amp;quot;: &amp;quot;value12&amp;quot;,
                    &amp;quot;property0-key3&amp;quot;: &amp;quot;value13&amp;quot;,
                    &amp;quot;property0-key4&amp;quot;: &amp;quot;value14&amp;quot;
                },
                &amp;quot;property2&amp;quot;: {
                    &amp;quot;property2-key1&amp;quot;: &amp;quot;value21&amp;quot;,
                    &amp;quot;property2-key2&amp;quot;: &amp;quot;value22&amp;quot;,
                    &amp;quot;property2-key3&amp;quot;: &amp;quot;value23&amp;quot;,
                    &amp;quot;property2-key4&amp;quot;: &amp;quot;value24&amp;quot;
                },
                ...
                &amp;quot;property9&amp;quot;: {
                    &amp;quot;property9-key1&amp;quot;: &amp;quot;value91&amp;quot;,
                    &amp;quot;property9-key2&amp;quot;: &amp;quot;value92&amp;quot;,
                    &amp;quot;property9-key3&amp;quot;: &amp;quot;value93&amp;quot;,
                    &amp;quot;property9-key4&amp;quot;: &amp;quot;value94&amp;quot;
                }
            }
        }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then, &amp;quot;Commit&amp;quot;.&lt;/p&gt;
&lt;p&gt;This &amp;quot;desired&amp;quot; is very different from &amp;quot;reported&amp;quot;, so the cloud will now issue a large shadow delta update to the device, which should trigger the problem (it doesn&amp;#39;t really matter what the current &amp;quot;reported&amp;quot; of&amp;nbsp;the device is, if &amp;quot;desired&amp;quot; is large and different the problem will trigger)&lt;/p&gt;
&lt;p&gt;Our current HW/SW:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;nRF SDK&amp;nbsp;&lt;span&gt;2.9.0-7787b2649840&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;nRF9151 LACA A0A&lt;/li&gt;
&lt;li class="_devicePropStyle_2trfs_1"&gt;
&lt;div class="lo-row _content_2trfs_6"&gt;&lt;span&gt;mfw_nrf91x1_2.0.2&lt;/span&gt;&lt;/div&gt;
&lt;div class="lo-row _content_2trfs_6"&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="lo-row _content_2trfs_6"&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;Thanks&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/558359?ContentTypeID=1</link><pubDate>Fri, 09 Jan 2026 08:38:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c19790e5-817c-41f0-a521-2b92a39cc07d</guid><dc:creator>Pascal Hdz</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The logLvl can be changed here:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1767947568572v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;A few questions:&lt;/p&gt;
&lt;p&gt;Which mechanism are you using to change the shadow properties?&lt;/p&gt;
&lt;p&gt;Are you using the nRF9151? Which Modem firmware? Which NCS version?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Pascal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/558316?ContentTypeID=1</link><pubDate>Thu, 08 Jan 2026 15:23:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de81e023-57e9-40c1-a63e-da6a908ecdd6</guid><dc:creator>teba99</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/pascal-hdz"&gt;Pascal Hdz&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;Thanks. When you&amp;nbsp;write&lt;/p&gt;
&lt;p&gt;&amp;gt; Changed the&amp;nbsp;&lt;span&gt;logLvl to a different value so it is reported to the device the desired value.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Sorry, could you explain? Did you only change logLv in the desired or any of the&amp;nbsp;other app properties?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The problem is only triggered if the cloud issues a large shadow delta update message to the device. Typically, that means multiple of the properties (APP_MODULE_1, _2, _3, etc) must be changed in desired *at the same time*. Changing only one property (like logLvl) will not create a large enough shadow delta message. Or maybe I misunderstand what you tested.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Thanks&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/558289?ContentTypeID=1</link><pubDate>Thu, 08 Jan 2026 14:12:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fcd584bc-0686-462b-a36c-5be689bc3bd3</guid><dc:creator>Pascal Hdz</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I wasn&amp;#39;t able to reproduce the issue as you mentioned. The way I tried to reproduce it was as follow:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Used the &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/main/samples/cellular/nrf_cloud_multi_service"&gt;multi-service sample&lt;/a&gt;&amp;nbsp;with NCS v3.2.99-85b0c61de8ff&lt;/li&gt;
&lt;li&gt;Modified the &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/main/samples/cellular/nrf_cloud_multi_service/src/shadow_config.c"&gt;shadow_config.c file&lt;/a&gt;&amp;nbsp;based on your recommendations with the next code:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* Copyright (c) 2024 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/logging/log.h&amp;gt;
#include &amp;lt;zephyr/logging/log_ctrl.h&amp;gt;
#include &amp;lt;net/nrf_cloud_defs.h&amp;gt;

#include &amp;quot;shadow_config.h&amp;quot;
#if defined(CONFIG_NRF_CLOUD_COAP)
#include &amp;quot;shadow_support_coap.h&amp;quot;
#endif
#include &amp;quot;application.h&amp;quot;

LOG_MODULE_REGISTER(shadow_config, CONFIG_MULTI_SERVICE_LOG_LEVEL);

#define TEST_COUNTER_EN	&amp;quot;counterEnable&amp;quot;
#define APP_DATA_KEY	&amp;quot;appData&amp;quot;

/* Application data structure keys (15 modules, ~70 bytes each, totaling ~1 KB) */
#define APP_MODULE_1		&amp;quot;module_1&amp;quot;
#define APP_MODULE_2		&amp;quot;module_2&amp;quot;
#define APP_MODULE_3		&amp;quot;module_3&amp;quot;
#define APP_MODULE_4		&amp;quot;module_4&amp;quot;
#define APP_MODULE_5		&amp;quot;module_5&amp;quot;
#define APP_MODULE_6		&amp;quot;module_6&amp;quot;
#define APP_MODULE_7		&amp;quot;module_7&amp;quot;
#define APP_MODULE_8		&amp;quot;module_8&amp;quot;
#define APP_MODULE_9		&amp;quot;module_9&amp;quot;
#define APP_MODULE_10		&amp;quot;module_10&amp;quot;
#define APP_MODULE_11		&amp;quot;module_11&amp;quot;
#define APP_MODULE_12		&amp;quot;module_12&amp;quot;
#define APP_MODULE_13		&amp;quot;module_13&amp;quot;
#define APP_MODULE_14		&amp;quot;module_14&amp;quot;
#define APP_MODULE_15		&amp;quot;module_15&amp;quot;

/* Flag to indicate that the accepted shadow data has been received (MQTT only) */
static bool accepted_rcvd;

static int add_cfg_data(struct nrf_cloud_obj *const cfg_obj)
{
	/* Add the test counter state */
	return nrf_cloud_obj_bool_add(cfg_obj, TEST_COUNTER_EN, test_counter_enable_get(), false);
}

static int add_app_data(struct nrf_cloud_obj *const app_obj)
{
	int err = 0;
	const char *module_keys[] = {
		APP_MODULE_1, APP_MODULE_2, APP_MODULE_3, APP_MODULE_4, APP_MODULE_5,
		APP_MODULE_6, APP_MODULE_7, APP_MODULE_8, APP_MODULE_9, APP_MODULE_10,
		APP_MODULE_11, APP_MODULE_12, APP_MODULE_13, APP_MODULE_14, APP_MODULE_15
	};

	/* Add 15 application-specific structures (~70 bytes per module, totaling ~1 KB) */
	for (int i = 0; i &amp;lt; 15; i++) {
		NRF_CLOUD_OBJ_JSON_DEFINE(module_obj);

		if (nrf_cloud_obj_init(&amp;amp;module_obj)) {
			LOG_ERR(&amp;quot;Failed to initialize module object %d&amp;quot;, i + 1);
			return -ENOMEM;
		}

		/* Add module-specific key/value fields (~70 bytes per structure) */
		err = nrf_cloud_obj_num_add(&amp;amp;module_obj, &amp;quot;id&amp;quot;, (double)(i + 1), false);
		if (err) {
			nrf_cloud_obj_free(&amp;amp;module_obj);
			return err;
		}

		err = nrf_cloud_obj_bool_add(&amp;amp;module_obj, &amp;quot;active&amp;quot;, true, false);
		if (err) {
			nrf_cloud_obj_free(&amp;amp;module_obj);
			return err;
		}

		err = nrf_cloud_obj_num_add(&amp;amp;module_obj, &amp;quot;version&amp;quot;, (double)(100 + i), false);
		if (err) {
			nrf_cloud_obj_free(&amp;amp;module_obj);
			return err;
		}

		err = nrf_cloud_obj_num_add(&amp;amp;module_obj, &amp;quot;status&amp;quot;, (double)(i % 3), false);
		if (err) {
			nrf_cloud_obj_free(&amp;amp;module_obj);
			return err;
		}

		err = nrf_cloud_obj_num_add(&amp;amp;module_obj, &amp;quot;counter&amp;quot;, (double)(i * 100), false);
		if (err) {
			nrf_cloud_obj_free(&amp;amp;module_obj);
			return err;
		}

		err = nrf_cloud_obj_num_add(&amp;amp;module_obj, &amp;quot;timestamp&amp;quot;, (double)k_uptime_get(), false);
		if (err) {
			nrf_cloud_obj_free(&amp;amp;module_obj);
			return err;
		}

		/* Add this module object to the main app data object */
		err = nrf_cloud_obj_object_add(app_obj, module_keys[i], &amp;amp;module_obj, false);
		if (err) {
			nrf_cloud_obj_free(&amp;amp;module_obj);
			return err;
		}
	}

	return err;
}

static int process_cfg(struct nrf_cloud_obj *const cfg_obj)
{
	bool val;
	int err = nrf_cloud_obj_bool_get(cfg_obj, TEST_COUNTER_EN, &amp;amp;val);

	if (err == 0) {
		/* The expected key/value was found, set the test counter enable state */
		test_counter_enable_set(val);
	} else if (err == -ENOMSG) {
		/* The key was found, but the value was not a boolean */
		LOG_WRN(&amp;quot;Invalid configuration value&amp;quot;);
		/* Reject the config */
		err = -EBADF;
	} else {
		LOG_DBG(&amp;quot;Expected data not found in config object&amp;quot;);
		err = -ENOMSG;
	}

	return err;
}

static int send_config(void)
{
	int err;

	NRF_CLOUD_OBJ_JSON_DEFINE(root_obj);
	NRF_CLOUD_OBJ_JSON_DEFINE(state_obj);
	NRF_CLOUD_OBJ_JSON_DEFINE(reported_obj);
	NRF_CLOUD_OBJ_JSON_DEFINE(cfg_obj);
	NRF_CLOUD_OBJ_JSON_DEFINE(app_obj);

	if (nrf_cloud_obj_init(&amp;amp;cfg_obj) || nrf_cloud_obj_init(&amp;amp;reported_obj) ||
	    nrf_cloud_obj_init(&amp;amp;state_obj) || nrf_cloud_obj_init(&amp;amp;root_obj) || 
		nrf_cloud_obj_init(&amp;amp;app_obj)) {
		err = -ENOMEM;
		goto cleanup;
	}

	/* Add the supported configuration data */
	err = add_cfg_data(&amp;amp;cfg_obj);
	if (err) {
		goto cleanup;
	}

#if defined(CONFIG_NRF_CLOUD_MQTT)

	/* Add application-specific reported data */
	err = add_app_data(&amp;amp;app_obj);
	if (err) {
		goto cleanup;
	}

	/* Add config to reported */
	err = nrf_cloud_obj_object_add(&amp;amp;reported_obj, NRF_CLOUD_JSON_KEY_CFG, &amp;amp;cfg_obj, false);
	if (err) {
		goto cleanup;
	}

	/* Add app data to reported */
	err = nrf_cloud_obj_object_add(&amp;amp;reported_obj, NRF_CLOUD_JSON_KEY_CFG, &amp;amp;app_obj, false);
	if (err) {
		goto cleanup;
	}

	/* Add reported to state */
	err = nrf_cloud_obj_object_add(&amp;amp;state_obj, NRF_CLOUD_JSON_KEY_REP, &amp;amp;reported_obj, false);
	if (err) {
		goto cleanup;
	}

	/* Add state to the root object */
	err = nrf_cloud_obj_object_add(&amp;amp;root_obj, NRF_CLOUD_JSON_KEY_STATE, &amp;amp;state_obj, false);
	if (err) {
		goto cleanup;
	}

	/* Send to the cloud */
	err = nrf_cloud_obj_shadow_update(&amp;amp;root_obj);
#else  /* CONFIG_NRF_CLOUD_COAP */

	/* Add config to root */
	err = nrf_cloud_obj_object_add(&amp;amp;root_obj, NRF_CLOUD_JSON_KEY_CFG, &amp;amp;cfg_obj, false);
	if (err) {
		goto cleanup;
	}

	err = shadow_support_coap_obj_send(&amp;amp;root_obj, false);
#endif

cleanup:
	nrf_cloud_obj_free(&amp;amp;root_obj);
	nrf_cloud_obj_free(&amp;amp;state_obj);
	nrf_cloud_obj_free(&amp;amp;reported_obj);
	nrf_cloud_obj_free(&amp;amp;cfg_obj);
	nrf_cloud_obj_free(&amp;amp;app_obj);
	return err;
}

void shadow_config_cloud_connected(void)
{
	accepted_rcvd = false;
}

int shadow_config_reported_send(void)
{
	LOG_INF(&amp;quot;Sending reported configuration&amp;quot;);

	int err = send_config();

	if (err) {
		LOG_ERR(&amp;quot;Failed to send configuration, error: %d&amp;quot;, err);
	}

	return err;
}

int shadow_config_delta_process(struct nrf_cloud_obj *const delta_obj)
{
	if (!delta_obj) {
		return -EINVAL;
	}

	if ((delta_obj-&amp;gt;type != NRF_CLOUD_OBJ_TYPE_JSON) || !delta_obj-&amp;gt;json) {
		/* No state JSON */
		return -ENOMSG;
	}

	/* If there is a pending delta event when the device establishes a cloud connection
	 * it is possible that it will be received before the accepted shadow data.
	 * Do not process a delta event until the accepted shadow data has been received.
	 * This is only a concern for MQTT.
	 */
	if (!accepted_rcvd &amp;amp;&amp;amp; IS_ENABLED(CONFIG_NRF_CLOUD_MQTT)) {
		return -EAGAIN;
	}

	int err;

	NRF_CLOUD_OBJ_JSON_DEFINE(cfg_obj);

	/* Get the config object */
	err = nrf_cloud_obj_object_detach(delta_obj, NRF_CLOUD_JSON_KEY_CFG, &amp;amp;cfg_obj);
	if (err == -ENODEV) {
		/* No config in the delta */
		return -ENOMSG;
	}

	/* Process the configuration */
	err = process_cfg(&amp;amp;cfg_obj);

	if (err == -EBADF) {
		/* Clear incoming config and replace it with a good one */
		nrf_cloud_obj_free(&amp;amp;cfg_obj);
		nrf_cloud_obj_init(&amp;amp;cfg_obj);
		if (add_cfg_data(&amp;amp;cfg_obj)) {
			LOG_ERR(&amp;quot;Failed to create delta response&amp;quot;);
		}
	}

	/* Add the config object back into the state so the response can be sent */
	if (nrf_cloud_obj_object_add(delta_obj, NRF_CLOUD_JSON_KEY_CFG, &amp;amp;cfg_obj, false)) {
		nrf_cloud_obj_free(&amp;amp;cfg_obj);
		return -ENOMEM;
	}

	return err;
}

int shadow_config_accepted_process(struct nrf_cloud_obj *const accepted_obj)
{
	if (!accepted_obj) {
		return -EINVAL;
	}

	/* The accepted shadow has been received */
	accepted_rcvd = true;

	if ((accepted_obj-&amp;gt;type != NRF_CLOUD_OBJ_TYPE_JSON) || !accepted_obj-&amp;gt;json) {
		/* No config JSON */
		return -ENOMSG;
	}

	return process_cfg(accepted_obj);
}
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Enabled the Shadow Transforms and debug log level for nRF_Cloud module in the prj.conf&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NRF_CLOUD_MQTT_SHADOW_TRANSFORMS=y
CONFIG_NRF_CLOUD_LOG_LEVEL_DBG=y&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Compiled it targeted for a nRF9151DK&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;west build -p -b nrf9151dk/nrf9151/ns&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Onboard it to my account.&lt;/li&gt;
&lt;li&gt;Changed the&amp;nbsp;&lt;span&gt;logLvl to a different value so it is reported to the device the desired value.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;As I couldn&amp;#39;t see any issues neither reset in the serial log, I proceeded to update the Modem Firmware from 2.0.2 to the latest 2.0.4. The updated succeed and no issues were reported in the serial log.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Let me know if I missed any step to try to reproduce your issue.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Pascal.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/558243?ContentTypeID=1</link><pubDate>Thu, 08 Jan 2026 09:55:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6db1eb46-129e-4a13-91ef-70f846375f60</guid><dc:creator>teba99</dc:creator><description>&lt;p&gt;Thank you. Please let me know how I can help. This issue is causing us a fair amount of pain, and it will get worse as we roll out more devices.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/558238?ContentTypeID=1</link><pubDate>Thu, 08 Jan 2026 08:52:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9dfe2a6e-2276-4df8-a1a9-a29a62d96e15</guid><dc:creator>Pascal Hdz</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thanks for the input, I will try to recreate the problem and let you know if I managed to do it.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Pascal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/558202?ContentTypeID=1</link><pubDate>Wed, 07 Jan 2026 15:58:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f9042b0-1023-4841-85b2-654edd190986</guid><dc:creator>teba99</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/pascal-hdz"&gt;Pascal Hdz&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;We&amp;#39;re using the default MQTT setup for device communication:&lt;br /&gt;CONFIG_NRF_CLOUD_MQTT=y&lt;br /&gt;CONFIG_NRF_CLOUD_MQTT_SHADOW_TRANSFORMS=y&lt;/p&gt;
&lt;p&gt;and we handle the shadow events as per the Nordic examples:&lt;br /&gt;NRF_CLOUD_EVT_RX_DATA_SHADOW&lt;br /&gt;NRF_CLOUD_EVT_TX_DATA_SHADOW&lt;/p&gt;
&lt;p&gt;&amp;gt;&lt;span&gt;Are you able to recreate this problem locally?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;We can recreate the problem reliably on&amp;nbsp;every device, but not only locally of course, because the cloud must send a shadow update that is larger than 2k to trigger the problem.&lt;/p&gt;
&lt;p&gt;I think you should be able to&amp;nbsp;confirm&amp;nbsp;this yourself fairly easily:&lt;/p&gt;
&lt;p&gt;1. Extend a device shadow&amp;nbsp;with an application-specific &amp;quot;reported&amp;quot; section containing&amp;nbsp;a number of key/value&amp;nbsp;structures&amp;nbsp;(like&amp;nbsp;15&amp;nbsp;structures&amp;nbsp;sized 70 bytes each, which is about 1 KB in size).&lt;/p&gt;
&lt;p&gt;2. Then, on the cloud, issue a &amp;quot;desired&amp;quot; update where most of these&amp;nbsp;&lt;span&gt;key/value&amp;nbsp;&lt;/span&gt;&lt;span&gt;structures are changed --&amp;gt; this&amp;nbsp;results in&amp;nbsp;a large shadow delta.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. The cloud will&amp;nbsp;send a large shadow delta update message to the device.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;4.&amp;nbsp;The device is forced to receive this&amp;nbsp;message.&amp;nbsp;Depending on the structure and changes in the shadow, the&amp;nbsp;message will likely exceeds the 2k TLS modem buffer and the device disconnects immediately&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;5.&amp;nbsp;Since the shadow message was not acknowledged it remains in the network queue,&amp;nbsp;so every time the device reconnects it will re-receive the message and&amp;nbsp;disconnect again.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/558191?ContentTypeID=1</link><pubDate>Wed, 07 Jan 2026 14:57:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f4ad3bf-b717-4c8e-bf30-34a281d4ef66</guid><dc:creator>Pascal Hdz</dc:creator><description>&lt;p&gt;Hello &lt;a href="https://devzone.nordicsemi.com/members/teba99"&gt;teba99&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry to hear that you are having issues with device shadow. I would like to understand a bit more this problematic:&lt;/p&gt;
&lt;p&gt;- Which protocol are you using?&lt;br /&gt;- Are you able to recreate this problem locally?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Pascal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/557456?ContentTypeID=1</link><pubDate>Fri, 19 Dec 2025 15:07:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72e7d6a1-96c0-4879-81d5-cbc6c250ae10</guid><dc:creator>teba99</dc:creator><description>&lt;p&gt;Hi Michael,&lt;/p&gt;
&lt;p&gt;No worries, thank you. We are currently working around this, but we&amp;#39;re looking for a more robust and permanent solution, so we can wait. Happy Holidays!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disconnect/reconnect loop when shadow messages are larger than modem 2K TLS buffer</title><link>https://devzone.nordicsemi.com/thread/557442?ContentTypeID=1</link><pubDate>Fri, 19 Dec 2025 14:18:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4759beb-06fd-4779-8d54-16d0505f2fe1</guid><dc:creator>Michal</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have asked the Cloud team if they could provide some insight, but since we are closely approaching Christmas, this may not happen until after the New Year.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Michal&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>