mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 10:29:17 +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) => {
|
||||
if (secret.type === 'encrypted') {
|
||||
// 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}`,
|
||||
{
|
||||
params,
|
||||
@@ -587,6 +587,8 @@ const syncSecretsVercel = async ({
|
||||
}
|
||||
}
|
||||
)).data;
|
||||
|
||||
return decryptedSecret;
|
||||
}
|
||||
|
||||
return secret;
|
||||
@@ -654,12 +656,9 @@ const syncSecretsVercel = async ({
|
||||
);
|
||||
}
|
||||
|
||||
// Sync/push updated secrets
|
||||
if (updateSecrets.length > 0) {
|
||||
updateSecrets.forEach(async (secret: VercelSecret) => {
|
||||
const { id, ...updatedSecret } = secret;
|
||||
|
||||
for await (const secret of updateSecrets) {
|
||||
if (secret.type !== 'sensitive') {
|
||||
const { id, ...updatedSecret } = secret;
|
||||
await axios.patch(
|
||||
`${INTEGRATION_VERCEL_API_URL}/v9/projects/${integration.app}/env/${secret.id}`,
|
||||
updatedSecret,
|
||||
@@ -672,12 +671,9 @@ const syncSecretsVercel = async ({
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Delete secrets
|
||||
if (deleteSecrets.length > 0) {
|
||||
deleteSecrets.forEach(async (secret: VercelSecret) => {
|
||||
for await (const secret of deleteSecrets) {
|
||||
await axios.delete(
|
||||
`${INTEGRATION_VERCEL_API_URL}/v9/projects/${integration.app}/env/${secret.id}`,
|
||||
{
|
||||
@@ -688,8 +684,8 @@ const syncSecretsVercel = async ({
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
Sentry.setUser(null);
|
||||
Sentry.captureException(err);
|
||||
|
||||
Reference in New Issue
Block a user