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