track quota errors in deployment
This commit is contained in:
parent
28360ded59
commit
b355b8bad9
|
@ -7,6 +7,12 @@
|
|||
import { notifier } from "builderStore/store/notifications"
|
||||
import CreateWebhookDeploymentModal from "./CreateWebhookDeploymentModal.svelte"
|
||||
|
||||
const DeploymentStatus = {
|
||||
SUCCESS: "SUCCESS",
|
||||
PENDING: "PENDING",
|
||||
FAILURE: "FAILURE",
|
||||
}
|
||||
|
||||
const DATE_OPTIONS = {
|
||||
fullDate: {
|
||||
weekday: "long",
|
||||
|
@ -56,7 +62,7 @@
|
|||
<header>
|
||||
<h4>Deployment History</h4>
|
||||
<div class="deploy-div">
|
||||
{#if deployments.some(deployment => deployment.status === 'SUCCESS')}
|
||||
{#if deployments.some(deployment => deployment.status === DeploymentStatus.SUCCESS)}
|
||||
<a target="_blank" href={`https://${appId}.app.budi.live/${appId}`}>
|
||||
View Your Deployed App →
|
||||
</a>
|
||||
|
@ -82,6 +88,9 @@
|
|||
<div class={`deployment-status ${deployment.status}`}>
|
||||
{deployment.status}
|
||||
</div>
|
||||
{#if deployment.status === DeploymentStatus.FAILURE}
|
||||
<span>{deployment.err}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</article>
|
||||
{/each}
|
||||
|
|
|
@ -55,17 +55,17 @@ exports.verifyDeployment = async function({ appId, quota }) {
|
|||
}),
|
||||
})
|
||||
|
||||
const json = await response.json()
|
||||
if (json.errors) {
|
||||
throw new Error(json.errors)
|
||||
}
|
||||
|
||||
if (response.status !== 200) {
|
||||
throw new Error(
|
||||
`Error fetching temporary credentials for api key: ${env.BUDIBASE_API_KEY}`
|
||||
)
|
||||
}
|
||||
|
||||
const json = await response.json()
|
||||
if (json.errors) {
|
||||
throw new Error(json.errors)
|
||||
}
|
||||
|
||||
// set credentials here, means any time we're verified we're ready to go
|
||||
if (json.credentials) {
|
||||
AWS.config.update({
|
||||
|
|
|
@ -21,18 +21,15 @@ const DeploymentStatus = {
|
|||
// checks that deployments are in a good state, any pending will be updated
|
||||
async function checkAllDeployments(deployments) {
|
||||
let updated = false
|
||||
function update(deployment, status) {
|
||||
deployment.status = status
|
||||
updated = true
|
||||
}
|
||||
|
||||
for (let deployment of Object.values(deployments.history)) {
|
||||
// check that no deployments have crashed etc and are now stuck
|
||||
if (
|
||||
deployment.status === DeploymentStatus.PENDING &&
|
||||
Date.now() - deployment.updatedAt > MAX_PENDING_TIME_MS
|
||||
) {
|
||||
update(deployment, DeploymentStatus.FAILURE)
|
||||
deployment.status = status
|
||||
deployment.err = "Timed out"
|
||||
updated = true
|
||||
}
|
||||
}
|
||||
return { updated, deployments }
|
||||
|
|
Loading…
Reference in New Issue