mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 12:27:28 +00:00
Merge pull request #2986 from Infisical/misc/addressed-cf-pages-error-304
fix: addressed cloudflare pages error 304
This commit is contained in:
@@ -3711,11 +3711,10 @@ const syncSecretsCloudflarePages = async ({
|
|||||||
const getSecretsRes = (
|
const getSecretsRes = (
|
||||||
await request.get<{
|
await request.get<{
|
||||||
result: { deployment_configs: Record<string, { env_vars: Record<string, unknown> }> };
|
result: { deployment_configs: Record<string, { env_vars: Record<string, unknown> }> };
|
||||||
}>(`${IntegrationUrls.CLOUDFLARE_PAGES_API_URL}/client/v4/accounts/${accessId}/pages/projects/${integration.app}?_=${Date.now()}`, {
|
}>(`${IntegrationUrls.CLOUDFLARE_PAGES_API_URL}/client/v4/accounts/${accessId}/pages/projects/${integration.app}`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
Accept: "application/json",
|
Accept: "application/json"
|
||||||
"Cache-Control": "no-store"
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
).data.result.deployment_configs[integration.targetEnvironment as string].env_vars;
|
).data.result.deployment_configs[integration.targetEnvironment as string].env_vars;
|
||||||
@@ -3751,17 +3750,28 @@ const syncSecretsCloudflarePages = async ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const metadata = z.record(z.any()).parse(integration.metadata);
|
const metadata = z.record(z.any()).parse(integration.metadata);
|
||||||
if (metadata.shouldAutoRedeploy) {
|
if (metadata.shouldAutoRedeploy && integration.targetEnvironment === "production") {
|
||||||
await request.post(
|
await request
|
||||||
`${IntegrationUrls.CLOUDFLARE_PAGES_API_URL}/client/v4/accounts/${accessId}/pages/projects/${integration.app}/deployments`,
|
.post(
|
||||||
{},
|
`${IntegrationUrls.CLOUDFLARE_PAGES_API_URL}/client/v4/accounts/${accessId}/pages/projects/${integration.app}/deployments`,
|
||||||
{
|
{},
|
||||||
headers: {
|
{
|
||||||
Authorization: `Bearer ${accessToken}`,
|
headers: {
|
||||||
Accept: "application/json"
|
Authorization: `Bearer ${accessToken}`,
|
||||||
|
Accept: "application/json"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
);
|
.catch((error) => {
|
||||||
|
if (error instanceof AxiosError && error.response?.status === 304) {
|
||||||
|
logger.info(
|
||||||
|
`syncSecretsCloudflarePages: CF pages redeployment returned status code 304 for integration [id=${integration.id}]`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+11
-9
@@ -192,15 +192,17 @@ export const CloudflarePagesConfigurePage = () => {
|
|||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<div className="mb-[2.36rem] ml-1 px-6">
|
{targetEnvironment === "production" && (
|
||||||
<Switch
|
<div className="mb-[2.36rem] ml-1 px-6">
|
||||||
id="redeploy-cloudflare-pages"
|
<Switch
|
||||||
onCheckedChange={(isChecked: boolean) => setShouldAutoRedeploy(isChecked)}
|
id="redeploy-cloudflare-pages"
|
||||||
isChecked={shouldAutoRedeploy}
|
onCheckedChange={(isChecked: boolean) => setShouldAutoRedeploy(isChecked)}
|
||||||
>
|
isChecked={shouldAutoRedeploy}
|
||||||
Auto-redeploy service upon secret change
|
>
|
||||||
</Switch>
|
Auto-redeploy service upon secret change
|
||||||
</div>
|
</Switch>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
onClick={handleButtonClick}
|
onClick={handleButtonClick}
|
||||||
color="mineshaft"
|
color="mineshaft"
|
||||||
|
|||||||
Reference in New Issue
Block a user