ยฉ 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
CD
Cloudflare Developers
โข
2y ago
โข
2 replies
DigitalDauber
How to trigger build fail
I am having an issue where a build completes successfully even when vital data is missing and makes the site unnavigable
.
How do I trigger a build fail if fetch does not return a valid response
?
Here is my Async Function
:
async fetch
(
)
{
/
/ Fetch the GlobalSettings object from Contentful
,
/
/ and if found bind it to a data prop
try
{
const settingsPromise
= this
.
$nacelle
.client
.query
(
{
query
: ALLCONTENT
,
variables
:
{
filter
:
{
handles
:
[
'global
-settings
'
]
,
type
:
'globalSettings
'
}
}
}
)
.then
(
(res
)
=
>
{
return res
.data
.allContent
.edges
[0
]
.node
}
)
const menusPromise
= this
.
$nacelle
.client
.query
(
{
query
: ALLCONTENT
,
variables
:
{
filter
:
{
type
:
'menu
'
,
first
: 500
}
}
}
)
.then
(
(res
)
=
>
{
return res
.data
.allContent
.edges
.map
(
(edge
)
=
> edge
.node
)
}
)
const
[
{ fields
}
, menus
]
= await Promise
.all
(
[
settingsPromise
,
menusPromise
]
)
this
.
$store
.commit
(
'space
/setMenus
'
, menus
)
const swatches
= this
.createColorCategories
(fields
?
.colorSwatches
)
this
.initializeGlobalSettings
(fields
)
this
.initializeColorCategories
(swatches
)
this
.initCartMotivator
(
)
} catch
(e
)
{
console
.warn
(
No Global Settings entry found.
No Global Settings entry found.
)
}
}
,
Cloudflare Developers
Join
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Was this page helpful?
Yes
No
Similar Threads
Recent Announcements
Similar Threads
cloudflare page fail build
CD
Cloudflare Developers / general-help
2y ago
Page build failed
CD
Cloudflare Developers / general-help
3y ago
Cloudflare Pages Build Failing
CD
Cloudflare Developers / general-help
17mo ago
HEIC images fail to upload
CD
Cloudflare Developers / general-help
5mo ago