# CODEBUILD\_FAILED error and layout issue

**URL:** <https://community.weweb.io/t/codebuild-failed-error-and-layout-issue/9208>\
**Category:** Ask us anything\
**Created:** [June 19, 2024, 6:55pm UTC](https://community.weweb.io/t/codebuild-failed-error-and-layout-issue/9208 "2024-06-19T18:55:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cteerakit](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/cteerakit/32/6405_2.png) [@cteerakit](https://community.weweb.io/u/cteerakit)\
**Post date:** [June 19, 2024, 6:55pm UTC](https://community.weweb.io/t/codebuild-failed-error-and-layout-issue/9208/1 "2024-06-19T18:55:08Z")

</div>

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/2/2d58d90aaf762fd9518c1d28709b0cf122eccdc9.png)

Hi, I’m facing this error quite often lately. It happens randomly and can be fixed by just republish the app again.

However, the published app seems unreliable with layout issues happen on random pages.

 ![Screenshot_20240620-013253](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/c/c673c2fb0b73761b6124b1876e51624001934e40.jpeg)  
This is the home page with layout issue, happen when accessing the page directly or refresh on the page.

The issue goes away when navigating to other page and back.

 ![Screenshot_20240620-013302](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b7d6590fb26ff1f14d6a9409bfda6843b31a95d5.jpeg)

This happens randomly on random pages. Not sure what is causing this behavior. It seems to only happen to this specific app. The other app works fine. And not sure if both of them are related.

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [June 19, 2024, 8:53pm UTC](https://community.weweb.io/t/codebuild-failed-error-and-layout-issue/9208/2 "2024-06-19T20:53:43Z")

</div>

Do you have any custom js/components?

---

<div class="post-metadata">

**Author:** ![cteerakit](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/cteerakit/32/6405_2.png) [@cteerakit](https://community.weweb.io/u/cteerakit)\
**Post date:** [June 20, 2024, 7:15am UTC](https://community.weweb.io/t/codebuild-failed-error-and-layout-issue/9208/3 "2024-06-20T07:15:50Z")

</div>

I do have some basic components like button, badge, etc. (no-code) And 2 lines of custom script for Zaraz and cookie banner.

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [June 20, 2024, 7:27am UTC](https://community.weweb.io/t/codebuild-failed-error-and-layout-issue/9208/4 "2024-06-20T07:27:51Z")

</div>

Any custom component/JavaScript can cause this, I’d suggest you look in the console for errors and maybe try switching off the scripts until it builds.

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [June 20, 2024, 11:07am UTC](https://community.weweb.io/t/codebuild-failed-error-and-layout-issue/9208/5 "2024-06-20T11:07:53Z")

</div>

> [@cteerakit](#):
>
> 2 lines of custom script for Zaraz

are you using zaraz with a domain proxied by cloudflare? if that’s the case probably prerendering the page will throw an error if your custom code is trying to access the global variable `zaraz` because it’s not there. if that’s the case you have multiple options to fix this:

- disable prerendering
- follow the guide to [use zaraz on domains not proxied by cloudflare](https://developers.cloudflare.com/zaraz/advanced/domains-not-proxied/)
- add a condition to your custom code not to execute if you are in the prerendering environment, you can check this variable `window. __WW_IS_PRERENDER__ ` ([source](https://github.com/weweb-assets/ww-html/blob/7f328b8e8e0ca89602fcac6b80a9c76c8da3beaf/src/wwElement.vue#L84C17-L84C43))

---

<div class="post-metadata">

**Author:** ![cteerakit](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/cteerakit/32/6405_2.png) [@cteerakit](https://community.weweb.io/u/cteerakit)\
**Post date:** [June 20, 2024, 1:11pm UTC](https://community.weweb.io/t/codebuild-failed-error-and-layout-issue/9208/6 "2024-06-20T13:11:52Z")

</div>

I didn’t know that I can have a domain proxied through Cloudflare with the app hosted with WeWeb. So I don’t 😅

> [@dorilama](#):
>
> follow the guide to [use zaraz on domains not proxied by cloudflare](https://developers.cloudflare.com/zaraz/advanced/domains-not-proxied/)

This is already the current setup I’m using unfortunately. I only have some tracking pixels in Zaraz which shouldn’t affect the appearance of the app. The other script is from Getterms for cookie consent, don’t expect this to break the page either.

Anyway I’ll do some experiments.

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/5/5a3c60981cdbe33b5fb4b301039c3a0aa5c9a5a0.png)
