Error deploying to fly.io

Deploying a nuxt app in fly.io is usually very easy. The fly cli handles everything for you. However, its the first time im using layers in a project and the usual process and configuration doesnt work. Got:
=> ERROR [build 5/6] RUN bun --bun run build 2.1s
> [build 5/6] RUN bun --bun run build:
0.064 $ nuxt build
0.407 Nuxt 3.14.159 with Nitro 2.10.3
1.601 WARN Cannot extend config from ../nuxtLayers/authentication2 in /app
1.622 WARN Cannot extend config from ../nuxtLayers/frontPageComponents in /app
1.640 WARN Cannot extend config from ../nuxtLayers/checkountnpricing2 in /app
1.661 WARN Cannot extend config from ../nuxtLayers/basicForms in /app
1.877 [nuxt:tailwindcss] ℹ Using default Tailwind CSS file
1.984 WARN Missing supabase url, set it either in nuxt.config.js or via env variable
1.985 WARN Missing supabase anon key, set it either in nuxt.config.js or via env variable
2.075 ERROR Nuxt module should be a function: @nuxt/image
2.075 at <anonymous> (node_modules/@nuxt/kit/dist/index.mjs:2460:15)
2.075 at processTicksAndRejections (native:7:39)
2.075 ERROR Nuxt module should be a function: @nuxt/image
2.091 error: script "build" exited with code 1
=> ERROR [build 5/6] RUN bun --bun run build 2.1s
> [build 5/6] RUN bun --bun run build:
0.064 $ nuxt build
0.407 Nuxt 3.14.159 with Nitro 2.10.3
1.601 WARN Cannot extend config from ../nuxtLayers/authentication2 in /app
1.622 WARN Cannot extend config from ../nuxtLayers/frontPageComponents in /app
1.640 WARN Cannot extend config from ../nuxtLayers/checkountnpricing2 in /app
1.661 WARN Cannot extend config from ../nuxtLayers/basicForms in /app
1.877 [nuxt:tailwindcss] ℹ Using default Tailwind CSS file
1.984 WARN Missing supabase url, set it either in nuxt.config.js or via env variable
1.985 WARN Missing supabase anon key, set it either in nuxt.config.js or via env variable
2.075 ERROR Nuxt module should be a function: @nuxt/image
2.075 at <anonymous> (node_modules/@nuxt/kit/dist/index.mjs:2460:15)
2.075 at processTicksAndRejections (native:7:39)
2.075 ERROR Nuxt module should be a function: @nuxt/image
2.091 error: script "build" exited with code 1
2 Replies
kapa.ai
kapa.ai2d ago
Hi @IsaacR943. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- It seems you're encountering issues while deploying a Nuxt app with layers to Fly.io. Let's address the main problems based on the error message: 1. Layer Extension Issues: The warnings about not being able to extend configs from various layers suggest that Fly.io's build process is not finding the layer directories. This is likely because the layers are not being included in the deployment. To resolve this, you may need to ensure that your layer directories are properly included in your project structure and that they are being copied to the deployment environment. You might need to modify your Dockerfile or fly.toml to include these directories. 2. Supabase Configuration: The warnings about missing Supabase URL and anon key indicate that your Supabase configuration is not being properly set. Make sure you're setting these environment variables either in your nuxt.config.ts file or in your Fly.io deployment configuration. 3. @nuxt/image Module Error: The error "Nuxt module should be a function: @nuxt/image" suggests an issue with the @nuxt/image module. This could be due to an incompatibility between the version of Nuxt you're using and the version of @nuxt/image. To resolve this, try the following: a. Ensure you're using a compatible version of @nuxt/image. You can try updating it to the latest version:
npm install @nuxt/image@latest
npm install @nuxt/image@latest
b. If that doesn't work, you might need to explicitly set the module in your nuxt.config.ts:
export default defineNuxtConfig({
modules: [
'@nuxt/image',
],
// ... other config
})
export default defineNuxtConfig({
modules: [
'@nuxt/image',
],
// ... other config
})
4. Bun Usage: The error shows that you're using Bun to run the build process. While Bun is gaining popularity, it might not be fully compatible with all Nuxt features yet. Consider switching to Node.js for the build process if these issues persist. 5. Deployment Configuration: Make sure your fly.toml file is correctly configured for a Nuxt 3 application. You might need to adjust the build and start commands. Here's a sample fly.toml configuration that might help:
[build]
builder = "heroku/buildpacks:20"

[build.args]
NODE_VERSION = "18"

[env]
HOST = "0.0.0.0"
NODE_ENV = "production"
PORT = "8080"

[experimental]
allowed_public_ports = []
auto_rollback = true

[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []

[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
force_https = true
handlers = ["http"]
port = 80

[[services.ports]]
handlers = ["tls", "http"]
port = 443
[build]
builder = "heroku/buildpacks:20"

[build.args]
NODE_VERSION = "18"

[env]
HOST = "0.0.0.0"
NODE_ENV = "production"
PORT = "8080"

[experimental]
allowed_public_ports = []
auto_rollback = true

[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []

[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
force_https = true
handlers = ["http"]
port = 80

[[services.ports]]
handlers = ["tls", "http"]
port = 443
Remember to set your Supabase and other environment variables using the Fly.io CLI or dashboard. If these steps don't resolve your issue, you might need to provide more details about your project structure, nuxt.config.ts, and Dockerfile (if you're using one) for further assistance. Nuxt Layers (https://nuxt.com/docs/getting-started/layers) | Nuxt Image Module (https://image.nuxt.com/get-started/installation) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2d ago
<@1223715160502571129> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Want results from more Discord servers?
Add your server