Skip to content

Commit cefa2b7

Browse files
committed
fix: Taxonomy Export Fails When Localization Not in Plan
1 parent 2798552 commit cefa2b7

File tree

5 files changed

+32
-12
lines changed

5 files changed

+32
-12
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/contentstack-export/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-cm-export",
33
"description": "Contentstack CLI plugin to export content from stack",
4-
"version": "1.21.0",
4+
"version": "1.21.1",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"dependencies": {

packages/contentstack-export/src/export/modules/taxonomies.ts

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ export default class ExportTaxonomies extends BaseClass {
7373
await this.fetchTaxonomies(masterLocale, true);
7474

7575
if (!this.isLocaleBasedExportSupported) {
76-
log.debug('Localization disabled, falling back to legacy export method', this.exportConfig.context);
76+
this.taxonomies = {};
77+
this.taxonomiesByLocale = {};
78+
79+
// Fetch taxonomies without locale parameter
80+
await this.fetchTaxonomies();
7781
await this.exportTaxonomies();
7882
await this.writeTaxonomiesMetadata();
7983
} else {
@@ -174,15 +178,20 @@ export default class ExportTaxonomies extends BaseClass {
174178
log.debug(`Completed fetching all taxonomies ${localeInfo}`, this.exportConfig.context);
175179
break;
176180
}
177-
} catch (error) {
181+
} catch (error: any) {
178182
log.debug(`Error fetching taxonomies ${localeInfo}`, this.exportConfig.context);
179-
handleAndLogError(error, {
180-
...this.exportConfig.context,
181-
...(localeCode && { locale: localeCode }),
182-
});
183-
if (checkLocaleSupport) {
183+
184+
if (checkLocaleSupport && this.isLocalePlanLimitationError(error)) {
185+
log.debug('Locale-based taxonomy export not supported, will use legacy method', this.exportConfig.context);
184186
this.isLocaleBasedExportSupported = false;
187+
} else {
188+
// Log actual errors during normal fetch
189+
handleAndLogError(error, {
190+
...this.exportConfig.context,
191+
...(localeCode && { locale: localeCode }),
192+
});
185193
}
194+
186195
// Break to avoid infinite retry loop on errors
187196
break;
188197
}
@@ -312,4 +321,15 @@ export default class ExportTaxonomies extends BaseClass {
312321

313322
return localesToExport;
314323
}
324+
325+
private isLocalePlanLimitationError(error: any): boolean {
326+
return (
327+
error?.status === 403 &&
328+
error?.errors?.taxonomies?.some(
329+
(msg: string) =>
330+
msg.toLowerCase().includes('taxonomy localization') &&
331+
msg.toLowerCase().includes('not included in your plan'),
332+
)
333+
);
334+
}
315335
}

packages/contentstack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@contentstack/cli-cm-branches": "~1.6.0",
2929
"@contentstack/cli-cm-bulk-publish": "~1.10.2",
3030
"@contentstack/cli-cm-clone": "~1.17.0",
31-
"@contentstack/cli-cm-export": "~1.21.0",
31+
"@contentstack/cli-cm-export": "~1.21.1",
3232
"@contentstack/cli-cm-export-to-csv": "~1.10.0",
3333
"@contentstack/cli-cm-import": "~1.29.0",
3434
"@contentstack/cli-cm-import-setup": "~1.7.0",

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)