ellie
ellie
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
It was a new env var that I defined for a new feature, I had forgotten to add it to fly (which I eventually did via their Secrets tab on the console). When it was missing, I was seeing the errors above!
33 replies
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
Everything is working now! The problem was that an env var that I added wasn't set on fly, but the server errors were misleading (and different from what I might see in dev mode on localhost) so it took me a bit to get to the bottom of. Here's the config:
app = "patentmapr-server"
primary_region = "ord"

[http_service]
auto_start_machines = true
auto_stop_machines = true
force_https = true
internal_port = 8_080
min_machines_running = 1
processes = [ "app" ]

[[vm]]
cpu_kind = "shared"
cpus = 1
memory = "1gb"
app = "patentmapr-server"
primary_region = "ord"

[http_service]
auto_start_machines = true
auto_stop_machines = true
force_https = true
internal_port = 8_080
min_machines_running = 1
processes = [ "app" ]

[[vm]]
cpu_kind = "shared"
cpus = 1
memory = "1gb"
33 replies
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
Ooop missed this for some reason, here are some of the errors:
WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:
- 0.0.0.0:8080
WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:
- 0.0.0.0:8080
^ this would show up during the wasp deploy fly deploy and then the server logs after that would have entries like this:
[error][PC01] instance refused connection. is your app listening on 0.0.0.0:8080? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)
...
[info]waiting for machine to be reachable on 0.0.0.0:8080 (waited 10.399511506s so far)
[error][PC01] instance refused connection. is your app listening on 0.0.0.0:8080? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)
...
[info]waiting for machine to be reachable on 0.0.0.0:8080 (waited 10.399511506s so far)
33 replies
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
Thanks for the triple backtick hint! I was wondering how to do that actually 😅 I have a separate file at the same level as actions.ts called llm.ts, and actions.ts includes methods from that file. In llm.ts, I have a top level const defining anthropic like this:
const anthropic = setupAnthropic();
const anthropic = setupAnthropic();
33 replies
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
Yeah, so weird! Even when I ran with verbose, I'd get entries like this (below) with some insight into the npm commands, etc., but the only hints about the crash were the exit code being 1 and then those misleading server addr bind errors [info]> npm run db-migrate-prod && NODE_ENV=production npm run start [info]> [email protected] db-migrate-prod [info]> prisma migrate deploy --schema=../db/schema.prisma [info]Prisma schema loaded from ../db/schema.prisma [info]Datasource "db": PostgreSQL database "patentmapr_server", schema "public" at "patentmapr-db.flycast:5432" [info]28 migrations found in prisma/migrations [info]No pending migrations to apply. [info]> [email protected] start [info]> npm run validate-env && node --enable-source-maps -r dotenv/config bundle/server.js [info]> [email protected] validate-env 2024-05-09T22:10:05Z app[82de77b793d118] ord [info]> node -r dotenv/config ./scripts/validate-env.mjs [info]🔍 Validating environment variables... [info]✅ Both STRIPE_CUSTOMER_PORTAL_LINK links defined [info] INFO Main child exited normally with code: 1 [info] INFO Starting clean up. [info][ 8.439734] reboot: Restarting system
33 replies
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
here it is! export function setupAnthropic() { if (!process.env.ANTHROPIC_API_KEY) { throw new Error('Anthropic API key is not set'); } return new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY }); }
33 replies
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
Of course! Stepped away from my desk but I’ll follow up in 45 minutes or so 🙂
33 replies
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
Yep exactly, I have a null check at runtime. Seems like the missing var prevents successful startup altogether in prod
33 replies
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
It was an API key I had added myself for a new feature… nothing from WASP itself! The frustrating part is that the app will start and a helpful error will print when running locally… but no such luck when deployed 😅 I’m not sure if that’s related to it being dockerized?
33 replies
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
It turns out this error is collateral from a missing env var on fly.io, ugh! If you're reading this, thanks for making it this far 😅 all good now
33 replies
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
Just tried a clean deployment starting from scratch with wasp deploy fly launch and I'm getting the same error. @kapa.ai where is the server addr set in the wasp project?
33 replies
WWasp-lang
Created by ellie on 5/9/2024 in #🙋questions
Server listen addr when deploying to fly.io
My server port is set in secrets, and my deployment had been working for a couple of months just fine until this week 😦 the outputs I included above are from flyctl logs, here's another warning that I see when I deploy manually (LOG_LEVEL=debug flyctl deploy --remote-only --config <path to fly-server.toml>): WARNING The app is not listening on the expected address and will not be reachable by fly-proxy. You can fix this by configuring your app to listen on the following addresses: - 0.0.0.0:8080
33 replies
WWasp-lang
Created by Kbk on 5/5/2024 in #🙋questions
Deploying on fly.io
just wanted to pop in and say that fly.io has had several incidents over the last 24 hours which are affecting deployments and machine availability, so there may be a problem that's not caused by you 🙂 (I spent a few hours down a rabbit hole last night when it turnd out to be a fly.io incident...)
21 replies