evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in SQL and markdown
https://evidence.dev
MIT License
4.5k stars 216 forks source link

[Bug]: Build fails on AWS CodeBuild #2682

Closed RoeeEidan closed 4 weeks ago

RoeeEidan commented 1 month ago

Describe the bug

The build fails with a unchanged new project.

Steps to Reproduce

  1. Install the Evidence vsCode extension
  2. Create new project
  3. Install dependencies
  4. Build project

Logs

node:internal/event_target:1012
  process.nextTick(() => { throw err; });
                           ^
Error: 500 /api//explore/console/evidencemeta.json (fetched from /explore/console/)
To suppress or handle this error, implement `handleHttpError` in https://kit.svelte.dev/docs/configuration#prerender
    at file:///workspaces/Backend-API/Evidence/node_modules/@sveltejs/kit/src/core/config/options.js:202:13
    at file:///workspaces/Backend-API/Evidence/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:65:25
    at save (file:///workspaces/Backend-API/Evidence/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:403:4)
    at visit (file:///workspaces/Backend-API/Evidence/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:260:4)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:300:10)
    at [kOnMessage] (node:internal/worker:311:37)
    at MessagePort.<anonymous> (node:internal/worker:212:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:737:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

Node.js v18.16.0
Build failed

file:///workspaces/Backend-API/Evidence/node_modules/@evidence-dev/evidence/cli.js:190
                        throw `Build process exited with code ${code}`;
                        ^
Build process exited with code 1
(Use `node --trace-uncaught ...` to show where the exception was thrown)

Node.js v18.16.0

System Info

Node.js v18.16.0
npm v9.5.1
Inside Github codespaces

Severity

blocking all usage of Evidence

Additional Information, or Workarounds

I'm vetting new BI tools and I really liked Evidence. But with the build failing on a fresh unchanged project, I don't know how to move forward

hughess commented 1 month ago

Hi @RoeeEidan i haven’t been able to reproduce this using the template repo in GitHub.

can you try creating a project from the use template button here and see if that’s different? https://github.com/evidence-dev/template

RoeeEidan commented 1 month ago

Thanks for the quick response @hughess! I tried the template and it didn't fix it.

Although, I did make some progress getting to the bottom of this.

I'm currently experiencing the issue in my github codespace mono repo, and I can confirm that the issue is not happening on my local machine. So it must be either because of the monorepo, or the codespace.

I'll try the mono repo on my local to check what it is.

RoeeEidan commented 1 month ago

It worked inside a monorepo on my local machine, so its something to do with my codespace setup

RoeeEidan commented 1 month ago

This is also happening when I try to build the template in production..

Here is the output when running npx evidence build --debug

Evidence running with debug logging
vite v5.4.6 building SSR bundle for production...
✓ 1448 modules transformed.
vite v5.4.6 building for production...
transforming (42) ../../node_modules/svelte/src/runtime/store/index.jsUpdating Parquet URLs
transforming (996) ../../node_modules/@evidence-dev/core-components/dist/atoms/shadcn/select/select-trigger.svelteBuild failed

file:///home/ec2-user/Backend-API/Evidence/node_modules/@evidence-dev/evidence/cli.js:190
                        throw `Build process exited with code ${code}`;
                        ^
Build process exited with code null
(Use `node --trace-uncaught ...` to show where the exception was thrown)

Node.js v18.20.4
RoeeEidan commented 1 month ago

When I run it in AWS CodeBuild, I get the following output


> my-evidence-project@0.0.1 build
--
60 | > evidence build
61 |  
62 | vite v5.4.6 building SSR bundle for production...
63 | transforming...
64 | ✓ 1448 modules transformed.
65 | rendering chunks...
66 | vite v5.4.6 building for production...
67 | transforming...
68 | ✓ 4447 modules transformed.
69 | rendering chunks...
70 | computing gzip size...
71 | .svelte-kit/output/client/_app/version.json                                                                 0.03 kB │ gzip:     0.05 kB
72 | .svelte-kit/output/client/_app/immutable/assets/wordmark-gray-800.CnzB_64T.png                             11.87 kB
73 | .svelte-kit/output/client/.vite/manifest.json                                                              32.75 kB │ gzip:     3.09 kB
74 | .svelte-kit/output/client/_app/immutable/assets/Spectral-ExtraLight.HPQmpGpQ.woff2                         55.57 kB
75 | .svelte-kit/output/client/_app/immutable/assets/Spectral-ExtraLightItalic.xW7ezc0a.woff2                   58.00 kB
76 | .svelte-kit/output/client/_app/immutable/assets/Spectral-Regular.BE1HJwUh.woff2                            58.09 kB
77 | .svelte-kit/output/client/_app/immutable/assets/Spectral-Italic.wSPWDyg7.woff2                             58.78 kB
78 | .svelte-kit/output/client/_app/immutable/assets/Spectral-Light.TIhg4DnI.woff2                              58.91 kB
79 | .svelte-kit/output/client/_app/immutable/assets/Spectral-ExtraBold.DeRaT2m-.woff2                          59.18 kB
80 | .svelte-kit/output/client/_app/immutable/assets/Spectral-ExtraBoldItalic.MQ9B1Gco.woff2                    59.74 kB
81 | .svelte-kit/output/client/_app/immutable/assets/Spectral-LightItalic.zW0f9iJS.woff2                        60.67 kB
82 | .svelte-kit/output/client/_app/immutable/assets/Spectral-SemiBold.zu1TM2FZ.woff2                           60.88 kB
83 | .svelte-kit/output/client/_app/immutable/assets/Spectral-Medium.NsGaEaui.woff2                             61.13 kB
84 | .svelte-kit/output/client/_app/immutable/assets/Spectral-Bold.BwJz_A1v.woff2                               61.29 kB
85 | .svelte-kit/output/client/_app/immutable/assets/Spectral-MediumItalic.BvSK_s7Y.woff2                       61.88 kB
86 | .svelte-kit/output/client/_app/immutable/assets/Spectral-SemiBoldItalic.D3fgUf4W.woff2                     62.13 kB
87 | .svelte-kit/output/client/_app/immutable/assets/Spectral-BoldItalic.CQC_WCFZ.woff2                         62.16 kB
88 | .svelte-kit/output/client/_app/immutable/assets/Spectral-ExtraLight.HAWHIZWB.woff                          69.52 kB
89 | .svelte-kit/output/client/_app/immutable/assets/Spectral-Regular.C0aqGnDS.woff                             72.05 kB
90 | .svelte-kit/output/client/_app/immutable/assets/Spectral-ExtraLightItalic.C9nFbxmj.woff                    72.68 kB
91 | .svelte-kit/output/client/_app/immutable/assets/Spectral-Light.DBct1VnS.woff                               72.94 kB
92 | .svelte-kit/output/client/_app/immutable/assets/Spectral-ExtraBold.Dm6k0JyR.woff                           73.01 kB
93 | .svelte-kit/output/client/_app/immutable/assets/Spectral-Italic.3s0_PsVL.woff                              73.28 kB
94 | .svelte-kit/output/client/_app/immutable/assets/Spectral-ExtraBoldItalic.SZr5i_vZ.woff                     74.36 kB
95 | .svelte-kit/output/client/_app/immutable/assets/Spectral-SemiBold.CCUIByHq.woff                            75.12 kB
96 | .svelte-kit/output/client/_app/immutable/assets/Spectral-LightItalic.B3o_X74d.woff                         75.20 kB
97 | .svelte-kit/output/client/_app/immutable/assets/Spectral-Medium.BZl4fq6u.woff                              75.20 kB
98 | .svelte-kit/output/client/_app/immutable/assets/Spectral-Bold.C57huwyI.woff                                75.81 kB
99 | .svelte-kit/output/client/_app/immutable/assets/Spectral-MediumItalic.De40Wj9n.woff                        76.62 kB
100 | .svelte-kit/output/client/_app/immutable/assets/Spectral-SemiBoldItalic.DjbDqXej.woff                      76.77 kB
101 | .svelte-kit/output/client/_app/immutable/assets/Spectral-BoldItalic.CQquRzSI.woff                          76.91 kB
102 | .svelte-kit/output/client/_app/immutable/assets/Inter-Regular.CKDp9E3C.woff2                               98.87 kB
103 | .svelte-kit/output/client/_app/immutable/assets/Inter-Thin.CSJ_owlW.woff2                                  99.63 kB
104 | .svelte-kit/output/client/_app/immutable/assets/Inter-Black.DgUKMdlB.woff2                                102.87 kB
105 | .svelte-kit/output/client/_app/immutable/assets/Inter-ExtraLight.egkqWonf.woff2                           104.23 kB
106 | .svelte-kit/output/client/_app/immutable/assets/Inter-Light.CdXm_ABL.woff2                                104.33 kB
107 | .svelte-kit/output/client/_app/immutable/assets/Inter-SemiBold.Ctx7G98q.woff2                             105.80 kB
108 | .svelte-kit/output/client/_app/immutable/assets/Inter-Medium.P1cOs5ep.woff2                               105.92 kB
109 | .svelte-kit/output/client/_app/immutable/assets/Inter-ExtraBold.B0QOs-T2.woff2                            106.11 kB
110 | .svelte-kit/output/client/_app/immutable/assets/Inter-Bold.CuhepTt8.woff2                                 106.14 kB
111 | .svelte-kit/output/client/_app/immutable/assets/Inter-ThinItalic.B6FKq6qK.woff2                           106.50 kB
112 | .svelte-kit/output/client/_app/immutable/assets/Inter-Italic._3PMmu0i.woff2                               106.88 kB
113 | .svelte-kit/output/client/_app/immutable/assets/Inter-BlackItalic.ZFcDzO3e.woff2                          108.75 kB
114 | .svelte-kit/output/client/_app/immutable/assets/Inter-LightItalic.COmGGTuG.woff2                          111.33 kB
115 | .svelte-kit/output/client/_app/immutable/assets/Inter-ExtraLightItalic.Bf25KIHs.woff2                     111.39 kB
116 | .svelte-kit/output/client/_app/immutable/assets/Inter-ExtraBoldItalic.OErwaGem.woff2                      111.71 kB
117 | .svelte-kit/output/client/_app/immutable/assets/Inter-BoldItalic.R15IsAnq.woff2                           111.81 kB
118 | .svelte-kit/output/client/_app/immutable/assets/Inter-SemiBoldItalic.BNz1Al2H.woff2                       112.05 kB
119 | .svelte-kit/output/client/_app/immutable/assets/Inter-MediumItalic.DWiIAHvp.woff2                         112.18 kB
120 | .svelte-kit/output/client/_app/immutable/assets/Inter-Regular.DJOZHnwz.woff                               133.84 kB
121 | .svelte-kit/output/client/_app/immutable/assets/Inter-Thin.CVMZtQER.woff                                  135.92 kB
122 | .svelte-kit/output/client/_app/immutable/assets/Inter-Black.DtxVgCT8.woff                                 138.76 kB
123 | .svelte-kit/output/client/_app/immutable/assets/Inter-Light.CG9upfZ4.woff                                 140.63 kB
124 | .svelte-kit/output/client/_app/immutable/assets/Inter-ExtraLight.CbFdmbHh.woff                            140.72 kB
125 | .svelte-kit/output/client/_app/immutable/assets/Inter-Medium.oHczPpWt.woff                                142.55 kB
126 | .svelte-kit/output/client/_app/immutable/assets/Inter-ExtraBold.B8imQN9B.woff                             142.92 kB
127 | .svelte-kit/output/client/_app/immutable/assets/Inter-SemiBold.BHlX_6qk.woff                              142.93 kB
128 | .svelte-kit/output/client/_app/immutable/assets/Inter-Bold.2PT7Q-hu.woff                                  143.21 kB
129 | .svelte-kit/output/client/_app/immutable/assets/Inter-Italic.Ci_5KQU1.woff                                144.37 kB
130 | .svelte-kit/output/client/_app/immutable/assets/Inter-ThinItalic.B2bFwwDp.woff                            145.48 kB
131 | .svelte-kit/output/client/_app/immutable/assets/Inter-BlackItalic.CkZ-ktDH.woff                           146.82 kB
132 | .svelte-kit/output/client/_app/immutable/assets/Inter-ExtraLightItalic.B3gY-m5W.woff                      150.00 kB
133 | .svelte-kit/output/client/_app/immutable/assets/Inter-LightItalic.C2ZuFZOC.woff                           150.09 kB
134 | .svelte-kit/output/client/_app/immutable/assets/Inter-ExtraBoldItalic.Bt8eprh6.woff                       150.63 kB
135 | .svelte-kit/output/client/_app/immutable/assets/Inter-MediumItalic.8laNK8GF.woff                          150.99 kB
136 | .svelte-kit/output/client/_app/immutable/assets/Inter-BoldItalic.C906RMVC.woff                            151.05 kB
137 | .svelte-kit/output/client/_app/immutable/assets/Inter-SemiBoldItalic.CxeAX7g8.woff                        151.18 kB
138 | .svelte-kit/output/client/_app/immutable/workers/duckdb-browser-eh.worker-DT-uzeza.js                     262.80 kB
139 | .svelte-kit/output/client/_app/immutable/workers/duckdb-browser-mvp.worker-DgEo6Ag5.js                    315.60 kB
140 | .svelte-kit/output/client/_app/immutable/assets/duckdb-eh.Bbw6HAmJ.wasm                                18,105.92 kB
141 | .svelte-kit/output/client/_app/immutable/assets/duckdb-mvp.IKz61icS.wasm                               22,092.38 kB
142 | .svelte-kit/output/client/_app/immutable/assets/0.Cc7Yja0k.css                                             67.47 kB │ gzip:    12.17 kB
143 | .svelte-kit/output/client/_app/immutable/assets/VennDiagram.BUbR3Yec.css                                   75.66 kB │ gzip:    16.92 kB
144 | .svelte-kit/output/client/_app/immutable/chunks/index.BrBg7kRw.js                                           0.04 kB │ gzip:     0.06 kB
145 | .svelte-kit/output/client/_app/immutable/entry/start.76WJIjt9.js                                            0.07 kB │ gzip:     0.08 kB
146 | .svelte-kit/output/client/_app/immutable/chunks/duckdb-eh.CFvZubNE.js                                       0.10 kB │ gzip:     0.12 kB
147 | .svelte-kit/output/client/_app/immutable/chunks/duckdb-mvp.CbpRbetm.js                                      0.10 kB │ gzip:     0.12 kB
148 | .svelte-kit/output/client/_app/immutable/chunks/duckdb-browser-eh.worker.Cbrkkz2F.js                        0.17 kB │ gzip:     0.16 kB
149 | .svelte-kit/output/client/_app/immutable/chunks/duckdb-browser-mvp.worker.Bw9aQXtH.js                       0.17 kB │ gzip:     0.16 kB
150 | .svelte-kit/output/client/_app/immutable/nodes/2.DQdzPajs.js                                                0.27 kB │ gzip:     0.22 kB
151 | .svelte-kit/output/client/_app/immutable/chunks/stores.B1iul3T9.js                                          0.29 kB │ gzip:     0.18 kB
152 | .svelte-kit/output/client/_app/immutable/nodes/3.BHdo2M7c.js                                                1.02 kB │ gzip:     0.61 kB
153 | .svelte-kit/output/client/_app/immutable/chunks/preload-helper.C1FmrZbK.js                                  1.14 kB │ gzip:     0.68 kB
154 | .svelte-kit/output/client/_app/immutable/chunks/updater.D06dw969.js                                         1.30 kB │ gzip:     0.73 kB
155 | .svelte-kit/output/client/_app/immutable/chunks/prism-python.DhmbaUsA.js                                    2.11 kB │ gzip:     1.09 kB
156 | .svelte-kit/output/client/_app/immutable/chunks/prism-svelte.DAwacStd.js                                    2.97 kB │ gzip:     0.96 kB
157 | .svelte-kit/output/client/_app/immutable/chunks/prism-sql.AgAyy5H_.js                                       3.26 kB │ gzip:     1.85 kB
158 | .svelte-kit/output/client/_app/immutable/chunks/prism-markdown.4MKFcK2x.js                                  5.24 kB │ gzip:     2.01 kB
159 | .svelte-kit/output/client/_app/immutable/chunks/prism-bash.DTkDXsAh.js                                      6.15 kB │ gzip:     3.04 kB
160 | .svelte-kit/output/client/_app/immutable/chunks/Button.CI11lQC2.js                                          8.05 kB │ gzip:     2.25 kB
161 | .svelte-kit/output/client/_app/immutable/chunks/Prismjs.C5ZtoCO9.js                                         8.44 kB │ gzip:     3.79 kB
162 | .svelte-kit/output/client/_app/immutable/chunks/index.BapEyOSa.js                                           9.40 kB │ gzip:     4.41 kB
163 | .svelte-kit/output/client/_app/immutable/nodes/1.Co-yTk3D.js                                               10.65 kB │ gzip:     3.78 kB
164 | .svelte-kit/output/client/_app/immutable/nodes/5.CDKhf8_H.js                                               10.88 kB │ gzip:     3.80 kB
165 | .svelte-kit/output/client/_app/immutable/chunks/scheduler.0nfGLaU7.js                                      11.26 kB │ gzip:     4.47 kB
166 | .svelte-kit/output/client/_app/immutable/nodes/6.D_na9QlM.js                                               12.42 kB │ gzip:     4.45 kB
167 | .svelte-kit/output/client/_app/immutable/entry/app.8ib1bsjj.js                                             14.28 kB │ gzip:     3.68 kB
168 | .svelte-kit/output/client/_app/immutable/chunks/entry.BK231WYM.js                                          33.67 kB │ gzip:    13.40 kB
169 | .svelte-kit/output/client/_app/immutable/chunks/button.D8cXa4Nh.js                                         40.48 kB │ gzip:    14.31 kB
170 | .svelte-kit/output/client/_app/immutable/chunks/AccordionItem.Bccw-NmC.js                                  50.94 kB │ gzip:     9.95 kB
171 | .svelte-kit/output/client/_app/immutable/nodes/7.yKK0c9_Z.js                                              239.95 kB │ gzip:    62.88 kB
172 | .svelte-kit/output/client/_app/immutable/nodes/0.DSj2T-l4.js                                              454.79 kB │ gzip:   101.08 kB
173 | .svelte-kit/output/client/_app/immutable/nodes/4.D0e8oO2D.js                                              520.56 kB │ gzip:    91.24 kB
174 | .svelte-kit/output/client/_app/immutable/chunks/VennDiagram.svelte_svelte_type_style_lang.Dfv6cJ0R.js   2,588.12 kB │ gzip:   788.22 kB
175 | .svelte-kit/output/client/_app/immutable/chunks/index.C6bJmPCA.js                                       5,163.93 kB │ gzip: 2,003.06 kB
176 |  
177 | (!) Some chunks are larger than 500 kB after minification. Consider:
178 | - Using dynamic import() to code-split the application
179 | - Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
180 | - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
181 | ✓ built in 49.06s
182 |  
183 | node:internal/event_target:1062
184 | process.nextTick(() => { throw err; });
185 | ^
186 | Error: 500 /api//explore/console/evidencemeta.json (fetched from /explore/console/)
187 | To suppress or handle this error, implement `handleHttpError` in https://kit.svelte.dev/docs/configuration#prerender
188 | at file:///codebuild/output/src3688105107/src/github.com/Carbon-Neutral-Club/Evidence/node_modules/@sveltejs/kit/src/core/config/options.js:202:13
189 | at file:///codebuild/output/src3688105107/src/github.com/Carbon-Neutral-Club/Evidence/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:65:25
190 | at save (file:///codebuild/output/src3688105107/src/github.com/Carbon-Neutral-Club/Evidence/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:403:4)
191 | at visit (file:///codebuild/output/src3688105107/src/github.com/Carbon-Neutral-Club/Evidence/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:260:4)
192 | Emitted 'error' event on Worker instance at:
193 | at [kOnErrorMessage] (node:internal/worker:314:10)
194 | at [kOnMessage] (node:internal/worker:325:37)
195 | at MessagePort.<anonymous> (node:internal/worker:225:57)
196 | at [nodejs.internal.kHybridDispatch] (node:internal/event_target:786:20)
197 | at exports.emitMessage (node:internal/per_context/messageport:23:28)
198 |  
199 | Node.js v18.20.3
200 | Build failed
201 |  
202 | file:///codebuild/output/src3688105107/src/github.com/Carbon-Neutral-Club/Evidence/node_modules/@evidence-dev/evidence/cli.js:190
203 | throw `Build process exited with code ${code}`;
204 | ^
205 | Build process exited with code 1
206 | (Use `node --trace-uncaught ...` to show where the exception was thrown)
207 |  
208 | Node.js v18.20.3

It seems like it build the project, but then fails to save it

RoeeEidan commented 1 month ago

Here's the error in --debug mode

{
  "error": {
    "message": "ENOENT: no such file or directory, open '/codebuild/output/src3395401549/src/github.com/Carbon-Neutral-Club/Evidence/.evidence/template/src/pages/explore/console/+page.md'",
    "errno": -2,
    "code": "ENOENT",
    "syscall": "open",
    "path": "/codebuild/output/src3395401549/src/github.com/Carbon-Neutral-Club/Evidence/.evidence/template/src/pages/explore/console/+page.md"
  },
  "event": {
    "cookies": {
      "get": "[Function: get]",
      "getAll": "[Function: getAll]",
      "set": "[Function: set]",
      "delete": "[Function: delete]",
      "serialize": "[Function: serialize]"
    },
    "fetch": "[Function (anonymous)]",
    "getClientAddress": "[Function: getClientAddress]",
    "locals": {},
    "params": {
      "route": "/explore/console"
    },
    "platform": null,
    "request": {
      "[Symbol(realm)]": "[Object]",
      "[Symbol(state)]": "[Object]",
      "[Symbol(signal)]": "[AbortSignal]",
      "[Symbol(headers)]": "[HeadersList]"
    },
    "route": {
      "id": "/api/[...route]/evidencemeta.json"
    },
    "setHeaders": "[Function: setHeaders]",
    "url": {
      "href": "http://sveltekit-prerender/api//explore/console/evidencemeta.json",
      "origin": "http://sveltekit-prerender",
      "protocol": "http:",
      "username": "",
      "password": "",
      "host": "sveltekit-prerender",
      "hostname": "sveltekit-prerender",
      "port": "",
      "pathname": "/api//explore/console/evidencemeta.json",
      "search": "",
      "searchParams": {},
      "hash": ""
    },
    "isDataRequest": false,
    "isSubRequest": true
  },
  "status": 500,
  "message": "Internal Error"
}
RoeeEidan commented 1 month ago

Turns out this issue happens when NODE_ENV is set (to development in Codespaces, and staging in CodeBuild).

I was able to get the build working by removing the NODE_ENV variable.

It might be more of an issue with svelte as opposed to evidence

RoeeEidan commented 4 weeks ago

Closing this issue as it's been resolved by removing the NODE_ENV variable.

I think it would be a nice addition if the build would have thrown a clear error, or even a warning.

I enjoy using evidence and likely going to hear from me again 😄

Happy halloween 🎃