I see these errors in terminal when i run fly launch:
PS D:\CODE\<myapp>_App_V2> fly launch
Scanning source code
Detected a SvelteKit app
Warning: This organization has no payment method, turning off high availability
Creating app in D:\CODE\<myapp>_App_V2
We're about to launch your SvelteKit app on Fly.io. Here's what you're getting:
Organization: <myOrg> (fly launch defaults to the personal org)
Name: <myapp>-app-v2 (derived from your directory name)
Region: Sydney, Australia (this is the fastest region for you)
App Machines: shared-cpu-1x, 1GB RAM (most apps need about 1GB of RAM)
Postgres: <none> (not requested)
Redis: <none> (not requested)
Tigris: private bucket (determined from app source)
? Do you want to tweak these settings before proceeding? Yes
Opening https://fly.io/cli/launch/..............7a716a696266743268656b ...
Waiting for launch data... Done
Created app '<myapp>-v1' in organization '<myapp>'
Admin URL: https://fly.io/apps/<myapp>-v1
Hostname: <myapp>-v1.fly.dev
Run `fly tokens create deploy -x 999999h` to create a token and set it as the FLY_API_TOKEN secret in your GitHub repository settings
? Overwrite "D:\CODE\<myapp>_App_V2\.github\workflows\fly-deploy.yml"? Yes
installing: npm install @flydotio/dockerfile@latest --save-devoy.yml"? (y/N) y
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: svelte-headless-table@0.18.3
npm ERR! Found: svelte@5.28.2
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^5.11.0" from bits-ui@1.4.3
npm ERR! node_modules/bits-ui
npm ERR! bits-ui@"^1.4.3" from the root project
npm ERR! peer svelte@"^3.49.0 || ^4.0.0 || ^5.0.0" from embla-carousel-svelte@8.6.0
npm ERR! node_modules/embla-carousel-svelte
npm ERR! dev embla-carousel-svelte@"^8.6.0" from the root project
npm ERR! 26 more (eslint-plugin-svelte, flowbite-svelte, formsnap, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: svelte@4.2.19
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: svelte@4.2.19
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! Could not resolve dependency:
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: svelte@4.2.19
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\<myself>\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! Could not resolve dependency:
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: svelte@4.2.19
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\<myself>\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! Could not resolve dependency:
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: svelte@4.2.19
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\<myself>\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! Could not resolve dependency:
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: svelte@4.2.19
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: svelte@4.2.19
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! Could not resolve dependency:
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: svelte@4.2.19
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! Could not resolve dependency:
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR!
npm ERR! Conflicting peer dependency: svelte@4.2.19
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte
npm ERR! node_modules/svelte
npm ERR! node_modules/svelte
npm ERR! peer svelte@"^4.0.0" from svelte-headless-table@0.18.3
npm ERR! node_modules/svelte-headless-table
npm ERR! dev svelte-headless-table@"^0.18.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\<myself>\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\<myself>\AppData\Local\npm-cache\_logs\2025-05-06T08_34_35_612Z-debug-0.log
Error: failed to install @flydotio/dockerfile: exit status 1
PS D:\CODE\<myapp>_App_V2>
I am using the latest versions of the packages in my SvelteKit project, and I can’t downgrade my svelte either. My app is using SvelteKit (svelte 5) which does build correctly locally when i use bun run build, and the packages do work with SvelteKit (svelte 5) because of the legacy svelte 4 compatibility however with the fly deployment process i get these errors. I’m a bit new to deployment so how can I get around this? I don’t fully understand the error in the fly.io context either.
Is there a way to modify the fly launch script to overcome this?
Are you using your own Dockerfile, or are you using the Dockerfile we provided? The first thing I notice is that you are running bun locally, but npm in the Dockerfile. Try running the following to generate a Dockerfile using bun:
bunx --bun dockerfile
Alternately, you can tell npm to ignore peer dependencies:
You’re running in the Windows PowerShell environment; in my experience that is nearly always why open source software crashes, as this env won’t be nearly so well tested as Bash. Could you try this in WSL instead?
Or, if you’re familiar with Docker, start up a shell in your runtime container locally, with an on-host volume, and that will give you a Linux environment in which you can run installation commands.
@halfer@rubys I’ve switched my SvelteKit adapter to bun’s SvelteKit adapter and i’m using Bash now.
I’ve done fly launch but halfway through it fails - something to do with <my_secret> is not exported by "virtual:env/static/public"
From that step I see a fresh fly.toml has been created, so i then tried then doing fly deploy again but it still fails, again:
==> Building image
Waiting for depot builder...
Waiting for depot builder...
Waiting for depot builder...
Waiting for depot builder...
==> Building image with Depot
--> build: ()
[+] Building 68.8s (16/19)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 1.07kB 0.1s
=> [internal] load metadata for docker.io/oven/bun:1 0.8s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 666B 0.1s
=> [base 1/2] FROM docker.io/oven/bun:1@sha256:6b75f9df71c53160c42a517efa70904ec39ba0eefd09c6c715d86facc9db33e2 0.0s
=> => resolve docker.io/oven/bun:1@sha256:6b75f9df71c53160c42a517efa70904ec39ba0eefd09c6c715d86facc9db33e2 0.0s
=> [internal] load build context 67.7s
=> => transferring context: 830.07kB 2.6s
=> CACHED [base 2/2] WORKDIR /usr/src/app 0.0s
=> CACHED [install 1/6] RUN mkdir -p /temp/dev 0.0s
=> CACHED [install 2/6] COPY package.json bun.lock /temp/dev/ 0.0s
=> CACHED [install 3/6] RUN cd /temp/dev && bun install --frozen-lockfile 0.0s
=> CACHED [install 4/6] RUN mkdir -p /temp/prod 0.0s
=> CACHED [install 5/6] COPY package.json bun.lock /temp/prod/ 0.0s
=> CACHED [install 6/6] RUN cd /temp/prod && bun install --frozen-lockfile --production 0.0s
=> CACHED [prerelease 1/4] COPY --from=install /temp/dev/node_modules node_modules 0.0s
=> CACHED [prerelease 2/4] COPY . . 0.0s
=> CACHED [prerelease 3/4] RUN bun test 0.0s
=> ERROR [prerelease 4/4] RUN bun run build 64.9s
=> CACHED [release 1/3] COPY --from=install /temp/prod/node_modules node_modules 0.0s
------
> [prerelease 4/4] RUN bun run build:
0.080 $ vite build
2.006 vite v6.3.4 building SSR bundle for production...
2.234 transforming...
64.27 ✓ 1462 modules transformed.
64.27 ✗ Build failed in 1m 2s
64.27 error during build:
64.27 src/lib/sdb/new/surrealdbConfig2.ts (3:1): "PUBLIC_SDB_CLOUD_HOST" is not exported by "virtual:env/static/public", imported by "src/lib/sdb/new/surrealdbConfig2.ts".
64.27 file: /usr/src/app/src/lib/sdb/new/surrealdbConfig2.ts:3:1
64.27
64.27 1: import {
64.27 2: // PUBLIC_SURREAL_HOST as host,
64.27 3: PUBLIC_SDB_CLOUD_HOST as host, // using 🟣⛅ Sdb Cloud
64.27 ^
64.27 4: PUBLIC_SURREAL_PORT as port,
64.27 5: PUBLIC_SURREAL_PROTOCOL as protocol
64.27
64.27 at getRollupError (/usr/src/app/node_modules/rollup/dist/es/shared/parseAst.js:397:45)
64.27 at error (/usr/src/app/node_modules/rollup/dist/es/shared/parseAst.js:393:42)
64.27 at findVariable (/usr/src/app/node_modules/rollup/dist/es/shared/node-entry.js:14855:39)
64.27 at findVariable (/usr/src/app/node_modules/rollup/dist/es/shared/node-entry.js:5583:38)
64.27 at findVariable (/usr/src/app/node_modules/rollup/dist/es/shared/node-entry.js:5583:38)
64.27 at bind (/usr/src/app/node_modules/rollup/dist/es/shared/node-entry.js:5357:40)
64.27 at bind (/usr/src/app/node_modules/rollup/dist/es/shared/node-entry.js:2784:23)
64.27 at bind (/usr/src/app/node_modules/rollup/dist/es/shared/node-entry.js:2784:23)
64.27 at bind (/usr/src/app/node_modules/rollup/dist/es/shared/node-entry.js:2784:23)
64.27 at bind (/usr/src/app/node_modules/rollup/dist/es/shared/node-entry.js:2784:23)
64.83 error: script "build" exited with code 1
------
Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c bun run build" did not complete successfully: exit code: 1
I have also set all of my env secrets to fly.io using fly secrets import < .env which i can confirm has staged the secrets for deployment in the fly ui / dashboard.
Why is this error happening? What further info/file can i share in order to get to the bottom of this?
Super, you’re one step further on. That looks to me like a normal transpilation or build problem, i.e. nothing to do with Fly. I’d personally switch to local Docker, so that you’re splitting the build and deploy phases (it won’t build, so there’s no point trying to deploy). However you can make do with your current command if you would find installing Docker a pain.
Next, I would search in this forum for PUBLIC_SDB_CLOUD_HOST; that feels like it should be set to something relating to SurrealDB. If you have no luck here, of course search Stack Overflow and the wider web.
Previously when it failed my .dockerignore contained these two lines:
**\.env
**\.env.*
When i removed them, the deploy now works. Was this the problem all along?!
Is removing these from the dockerignore bad practice? Where are my env secrets exposed to in this scenario?
Just to double confirm on something I previously did, I have manually done fly secrets import < .env and staged all my secrets (now deployed) on the fly. ie. i can see them on the web portal. This is still needed, right? OR with my above dockerignore adjustment, have i effectively created duplicates of secrets for my app? I’m trying to get my head around what has now happened and if anything is incorrect.
For ref. (and anyone else with same problem) my code>>>
//Dockerfile
# use the official Bun image
# see all versions at https://hub.docker.com/r/oven/bun/tags
FROM oven/bun:1 AS base
WORKDIR /usr/src/app
# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lock /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lock /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
# [optional] tests & build
ENV NODE_ENV=production
ENV ORIGIN=http://localhost:8080
ENV PORT=8080
RUN bun test
RUN bun --bun run build
# copy production dependencies and source code into final image
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/build ./build
COPY --from=prerelease /usr/src/app/package.json .
# run the app
USER bun
EXPOSE 3000/tcp
ENTRYPOINT [ "bun", "./build/index.js" ]
Your .dockerignore explains to Docker what can be ignored for the purposes of “build context”. This is the collection of files in your build directory that, when changed, will invalidate the Docker build cache.
When i removed them, the deploy now works. Was this the problem all along?
It sounds like it.
I’m trying to get my head around what has now happened and if anything is incorrect.
I am guessing that your COPY . . includes your local .env* file(s). This is probably not unsafe, as your images are still private, but it’s not ideal. I would suggest fixing this as an item of technical debt, either now or in the near future. If excluding these file(s) results in a non-working image then I would guess that your secrets are not working, maybe because you’re using the wrong env var names.
All that should matter what makes it to the last stage:
# copy production dependencies and source code into final image
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/build ./build
COPY --from=prerelease /usr/src/app/package.json .
# run the app
USER bun
EXPOSE 3000/tcp
ENTRYPOINT [ "bun", "./build/index.js" ]