fix: Detect if n8n instance is staging or production for community nodes (#15918)

This commit is contained in:
Jon
2025-06-04 17:41:00 +01:00
committed by GitHub
parent 4b11268a6e
commit 63cf9afe65

View File

@@ -1,5 +1,5 @@
import type { CommunityNodeType } from '@n8n/api-types';
import { Logger } from '@n8n/backend-common';
import { Logger, inProduction } from '@n8n/backend-common';
import { GlobalConfig } from '@n8n/config';
import { Service } from '@n8n/di';
import { ensureError, type INodeTypeDescription } from 'n8n-workflow';
@@ -46,7 +46,9 @@ export class CommunityNodeTypesService {
this.globalConfig.nodes.communityPackages.enabled &&
this.globalConfig.nodes.communityPackages.verifiedEnabled
) {
const environment = this.globalConfig.license.tenantId === 1 ? 'production' : 'staging';
// Cloud sets ENVIRONMENT to 'production' or 'staging' depending on the environment
const environment =
inProduction || process.env.ENVIRONMENT === 'production' ? 'production' : 'staging';
data = await getCommunityNodeTypes(environment);
}