mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-11 06:29:04 +00:00
Add for-await for better Vercel integration reliability
This commit is contained in:
@@ -577,7 +577,7 @@ const syncSecretsVercel = async ({
|
|||||||
.map(async (secret: VercelSecret) => {
|
.map(async (secret: VercelSecret) => {
|
||||||
if (secret.type === 'encrypted') {
|
if (secret.type === 'encrypted') {
|
||||||
// case: secret is encrypted -> need to decrypt
|
// case: secret is encrypted -> need to decrypt
|
||||||
return (await axios.get(
|
const decryptedSecret = (await axios.get(
|
||||||
`${INTEGRATION_VERCEL_API_URL}/v9/projects/${integration.app}/env/${secret.id}`,
|
`${INTEGRATION_VERCEL_API_URL}/v9/projects/${integration.app}/env/${secret.id}`,
|
||||||
{
|
{
|
||||||
params,
|
params,
|
||||||
@@ -587,6 +587,8 @@ const syncSecretsVercel = async ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)).data;
|
)).data;
|
||||||
|
|
||||||
|
return decryptedSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return secret;
|
return secret;
|
||||||
@@ -654,12 +656,9 @@ const syncSecretsVercel = async ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sync/push updated secrets
|
for await (const secret of updateSecrets) {
|
||||||
if (updateSecrets.length > 0) {
|
|
||||||
updateSecrets.forEach(async (secret: VercelSecret) => {
|
|
||||||
const { id, ...updatedSecret } = secret;
|
|
||||||
|
|
||||||
if (secret.type !== 'sensitive') {
|
if (secret.type !== 'sensitive') {
|
||||||
|
const { id, ...updatedSecret } = secret;
|
||||||
await axios.patch(
|
await axios.patch(
|
||||||
`${INTEGRATION_VERCEL_API_URL}/v9/projects/${integration.app}/env/${secret.id}`,
|
`${INTEGRATION_VERCEL_API_URL}/v9/projects/${integration.app}/env/${secret.id}`,
|
||||||
updatedSecret,
|
updatedSecret,
|
||||||
@@ -672,12 +671,9 @@ const syncSecretsVercel = async ({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete secrets
|
for await (const secret of deleteSecrets) {
|
||||||
if (deleteSecrets.length > 0) {
|
|
||||||
deleteSecrets.forEach(async (secret: VercelSecret) => {
|
|
||||||
await axios.delete(
|
await axios.delete(
|
||||||
`${INTEGRATION_VERCEL_API_URL}/v9/projects/${integration.app}/env/${secret.id}`,
|
`${INTEGRATION_VERCEL_API_URL}/v9/projects/${integration.app}/env/${secret.id}`,
|
||||||
{
|
{
|
||||||
@@ -688,8 +684,8 @@ const syncSecretsVercel = async ({
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Sentry.setUser(null);
|
Sentry.setUser(null);
|
||||||
Sentry.captureException(err);
|
Sentry.captureException(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user