Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Build fails when using different basePath and images #3107

Open
dantodor opened this issue Feb 26, 2025 · 2 comments
Open

[Bug]: Build fails when using different basePath and images #3107

dantodor opened this issue Feb 26, 2025 · 2 comments
Labels
bug Something isn't working to-review Evidence team to review

Comments

@dantodor
Copy link

Describe the bug

I have a simple logo.png that I use on the main page and in +layout.svelte. Image is as advised in static directory.
When I do an npm run build with no basePath in the evidence.config.yaml, everything works. But when I add the deployment path (I'm running several evidence projects on the same webserver, so I need this), build bombs out with:

evidence build


node:internal/event_target:1090
  process.nextTick(() => { throw err; });
                           ^
Error: 404 /logo2.png does not begin with `base`, which is configured in `paths.base` and can be imported from `$app/paths` - see https://svelte.dev/docs/kit/configuration#paths for more info (linked from /reports/Barometer/)
To suppress or handle this error, implement `handleHttpError` in https://svelte.dev/docs/kit/configuration#prerender
    at file:///opt/evidence/bar_new/barometer-evidence/node_modules/@sveltejs/kit/src/core/config/options.js:203:13
    at file:///opt/evidence/bar_new/barometer-evidence/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:71:25
    at visit (file:///opt/evidence/bar_new/barometer-evidence/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:201:4)
    at Object.fn (file:///opt/evidence/bar_new/barometer-evidence/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:190:22)
    at dequeue (file:///opt/evidence/bar_new/barometer-evidence/node_modules/@sveltejs/kit/src/core/postbuild/queue.js:40:42)
    at file:///opt/evidence/bar_new/barometer-evidence/node_modules/@sveltejs/kit/src/core/postbuild/queue.js:49:7

Node.js v22.11.0
Build failed

I'm not used at all with Svelte, so I don't understand exactly what it wants me to do.
What am I doing wrong?
TIA

Steps to Reproduce

npm run build with an embedded image and add a basePath to the deployment.

Logs

System Info

System:
    OS: Linux 6.8 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
    CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
    Memory: 39.55 GB / 62.58 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 22.11.0 - ~/.asdf/installs/nodejs/22.11.0/bin/node
    npm: 10.9.0 - ~/.asdf/plugins/nodejs/shims/npm
  npmPackages:
    @evidence-dev/bigquery: ^2.0.8 => 2.0.8
    @evidence-dev/core-components: ^5.2.0 => 5.2.0
    @evidence-dev/csv: ^1.0.13 => 1.0.13
    @evidence-dev/databricks: ^1.0.7 => 1.0.7
    @evidence-dev/duckdb: ^1.0.12 => 1.0.12
    @evidence-dev/evidence: ^40.1.1 => 40.1.1
    @evidence-dev/motherduck: ^1.0.3 => 1.0.3
    @evidence-dev/mssql: ^1.1.1 => 1.1.1
    @evidence-dev/mysql: ^1.1.3 => 1.1.3
    @evidence-dev/postgres: ^1.0.6 => 1.0.6
    @evidence-dev/snowflake: ^1.2.1 => 1.2.1
    @evidence-dev/sqlite: ^2.0.6 => 2.0.6
    @evidence-dev/trino: ^1.0.8 => 1.0.8

Severity

serious, but I can work around it

Additional Information, or Workarounds

No response

@dantodor dantodor added bug Something isn't working to-review Evidence team to review labels Feb 26, 2025
@archiewood
Copy link
Member

archiewood commented Feb 26, 2025

Do you need to prefix your images with the basePath in the layout?

https://docs.evidence.dev/deployment/configuration/base-paths/#custom-components

<script>
  import { addBasePath } from '@evidence-dev/sdk/utils/svelte';
</script>

<img src={addBasePath(link)}/>

@dantodor
Copy link
Author

I will try and report back. Thanks for the hint!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working to-review Evidence team to review
Projects
None yet
Development

No branches or pull requests

2 participants