Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: check null value

adilsonbc69cb62ea43
diff --git a/backend/src/services/app-connection/railway/railway-connection-public-client.ts b/backend/src/services/app-connection/railway/railway-connection-public-client.ts
index 05227abe54..2fda1f022d 100644
--- a/backend/src/services/app-connection/railway/railway-connection-public-client.ts
+++ b/backend/src/services/app-connection/railway/railway-connection-public-client.ts
@@ -45,7 +45,7 @@ export function getRailwayRatelimiter(headers: AxiosResponse["headers"]): {
const now = +new Date();
const nextReset = +new Date(limitResetAt);
- const remaining = Math.min(0, nextReset - now);
+ const remaining = Math.max(0, nextReset - now);
const wait = () => {
return new Promise<void>((res) => {
@@ -67,6 +67,7 @@ class RailwayPublicClient {
this.client = createRequestClient({
method: "POST",
baseURL: IntegrationUrls.RAILWAY_API_URL,
+ timeout: 1000 * 60, // 60 seconds timeout
headers: {
"Content-Type": "application/json"
}
@@ -223,7 +224,7 @@ class RailwayPublicClient {
config: RailwaySendReqOptions,
variables: { projectId: string; environmentId: string; serviceId?: string }
) {
- const res = await this.send<TRailwayResponse<{ variables: Record<string, string> }>>(
+ const res = await this.send<TRailwayResponse<{ variables: Record<string, string | null> }>>(
`query variables($projectId: String!, $environmentId: String!, $serviceId: String, $unrendered: Boolean) { variables( projectId: $projectId, environmentId: $environmentId, serviceId: $serviceId, unrendered: $unrendered ) }`,
config,
{ ...variables, unrendered: true }
diff --git a/backend/src/services/secret-sync/railway/railway-sync-fns.ts b/backend/src/services/secret-sync/railway/railway-sync-fns.ts
index 731691acfd..941873ff40 100644
--- a/backend/src/services/secret-sync/railway/railway-sync-fns.ts
+++ b/backend/src/services/secret-sync/railway/railway-sync-fns.ts
@@ -33,7 +33,9 @@ export const RailwaySyncFns = {
if (!matchesSchema(key, environment?.slug || "", keySchema)) continue;
entries[key] = {
- value
+ // Railway returns null for sealed/unrendered variables (unrendered: true);
+ // coalesce to "" so the value doesn't reach Buffer.from(null) during import.
+ value: value ?? ""
};
}
@@ -94,7 +96,7 @@ export const RailwaySyncFns = {
first: 1
});
- const latestDeploymentId = latestDeployment?.deployments.edges[0].node.id;
+ const latestDeploymentId = latestDeployment?.deployments.edges[0]?.node.id;
if (!latestDeploymentId)
throw new SecretSyncError({