Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## Version 4.2.2

### Date: 01-Jun-2026

- Fix: resolved data fetch failure for non-US regions (AZURE_NA, EU, AU, AZURE_EU, GCP_NA, GCP_EU) when connected via VPN by ensuring Stack.URL is correctly synced with the region-specific CDN host after config initialisation.

## Version 4.2.1

### Date: 20-Apr-2026
Expand Down
2 changes: 1 addition & 1 deletion contentstack/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
ext {
PUBLISH_GROUP_ID = 'com.contentstack.sdk'
PUBLISH_ARTIFACT_ID = 'android'
PUBLISH_VERSION = '4.2.1'
PUBLISH_VERSION = '4.2.2'
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ protected void setConfig(Config config) {
}
}
String endpoint = config.PROTOCOL + config.URL;
URL = config.URL;
this.config.setEndpoint(endpoint);
client(endpoint);

Expand Down
34 changes: 33 additions & 1 deletion contentstack/src/test/java/com/contentstack/sdk/TestStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
import org.robolectric.annotation.Config;

import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import static org.junit.Assert.*;

Expand Down Expand Up @@ -360,7 +362,7 @@ public void testStackWithCustomConfig() throws Exception {
@Test
public void testStackWithDifferentRegions() throws Exception {
com.contentstack.sdk.Config.ContentstackRegion[] regions = com.contentstack.sdk.Config.ContentstackRegion.values();

for (com.contentstack.sdk.Config.ContentstackRegion region : regions) {
com.contentstack.sdk.Config config = new com.contentstack.sdk.Config();
config.setRegion(region);
Expand All @@ -369,6 +371,36 @@ public void testStackWithDifferentRegions() throws Exception {
}
}

@Test
public void testAzureNaRegionSetsCorrectURL() throws Exception {
com.contentstack.sdk.Config config = new com.contentstack.sdk.Config();
config.setRegion(com.contentstack.sdk.Config.ContentstackRegion.AZURE_NA);
Stack regionalStack = Contentstack.stack(mockContext, "api_key", "token", "env", config);
assertEquals("azure-na-cdn.contentstack.com", regionalStack.URL);
}

@Test
public void testNonUsRegionsSetsCorrectStackURL() throws Exception {
Map<com.contentstack.sdk.Config.ContentstackRegion, String> expectedHosts = new HashMap<>();
expectedHosts.put(com.contentstack.sdk.Config.ContentstackRegion.EU, "eu-cdn.contentstack.io");
expectedHosts.put(com.contentstack.sdk.Config.ContentstackRegion.AU, "au-cdn.contentstack.com");
expectedHosts.put(com.contentstack.sdk.Config.ContentstackRegion.AZURE_NA, "azure-na-cdn.contentstack.com");
expectedHosts.put(com.contentstack.sdk.Config.ContentstackRegion.AZURE_EU, "azure-eu-cdn.contentstack.com");
expectedHosts.put(com.contentstack.sdk.Config.ContentstackRegion.GCP_NA, "gcp-na-cdn.contentstack.com");
expectedHosts.put(com.contentstack.sdk.Config.ContentstackRegion.GCP_EU, "gcp-eu-cdn.contentstack.com");

for (Map.Entry<com.contentstack.sdk.Config.ContentstackRegion, String> entry : expectedHosts.entrySet()) {
com.contentstack.sdk.Config config = new com.contentstack.sdk.Config();
config.setRegion(entry.getKey());
Stack regionalStack = Contentstack.stack(mockContext, "api_key", "token", "env", config);
assertEquals(
"Stack.URL mismatch for region " + entry.getKey(),
entry.getValue(),
regionalStack.URL
);
}
}

@Test
public void testContentTypeEntryCreation() {
ContentType contentType = stack.contentType("products");
Expand Down
Loading