2023-06-13T18:18:45Z app[17811199a00089] qro [info]Error: Can't reach database server at `qro.av-db.flycast`:`5432`
2023-06-13T18:18:45Z app[17811199a00089] qro [info]Please make sure your database server is running at `qro.av-db.flycast`:`5432`.
2023-06-13T18:18:45Z app[17811199a00089] qro [info] at r (/myapp/node_modules/@prisma/client/runtime/library.js:108:2574)
2023-06-13T18:18:45Z app[17811199a00089] qro [info]npm notice
2023-06-13T18:18:45Z app[17811199a00089] qro [info]npm notice New major version of npm available! 8.19.4 -> 9.7.1
2023-06-13T18:18:45Z app[17811199a00089] qro [info]npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.7.1>
2023-06-13T18:18:45Z app[17811199a00089] qro [info]npm notice Run `npm install -g npm@9.7.1` to update!
2023-06-13T18:18:45Z app[17811199a00089] qro [info]npm notice
2023-06-13T18:18:45Z app[17811199a00089] qro [info] INFO Main child exited normally with code: 1
2023-06-13T18:18:45Z app[17811199a00089] qro [info] INFO Starting clean up.
2023-06-13T18:18:45Z app[17811199a00089] qro [info] WARN hallpass exited, pid: 514, status: signal: 15 (SIGTERM)
2023-06-13T18:18:45Z app[17811199a00089] qro [info]2023/06/13 18:18:45 listening on [fdaa:0:c395:a7b:d3:e344:11a8:2]:22 (DNS: [fdaa::3]:53)
2023-06-13T18:18:46Z app[17811199a00089] qro [info][ 3.115483] reboot: Restarting system
2023-06-13T18:18:46Z runner[17811199a00089] qro [info]machine did not have a restart policy, defaulting to restart
2023-06-13T18:19:03Z app[17811199a00089] qro [info] INFO Starting init (commit: 0b28cec)...
2023-06-13T18:19:03Z app[17811199a00089] qro [info] INFO Preparing to run: `docker-entrypoint.sh npm start` as root
2023-06-13T18:19:03Z app[17811199a00089] qro [info] INFO [fly api proxy] listening at /.fly/api
2023-06-13T18:19:03Z app[17811199a00089] qro [info]2023/06/13 18:19:03 listening on [fdaa:0:c395:a7b:d3:e344:11a8:2]:22 (DNS: [fdaa::3]:53)
2023-06-13T18:19:03Z app[17811199a00089] qro [info]> start
2023-06-13T18:19:03Z app[17811199a00089] qro [info]> cross-env NODE_ENV=production node ./build/server.js
2023-06-13T18:19:04Z app[17811199a00089] qro [info]🔌 setting up prisma client to qro.av-db.flycast:5432
2023-06-13T18:19:05Z app[17811199a00089] qro [info]✅ app ready: http://localhost:8080
2023-06-13T18:19:05Z app[17811199a00089] qro [info]✅ metrics ready: http://localhost:8081/metrics
2023-06-13T18:19:05Z app[17811199a00089] qro [info]/myapp/node_modules/@prisma/client/runtime/library.js:108
2023-06-13T18:19:05Z app[17811199a00089] qro [info]You may have to run ${A("prisma generate")} for your changes to take effect.`,this.config.clientVersion);return r}parseEngineResponse(r){if(!r)throw new ne("Response from the Engine was empty",{clientVersion:this.config.clientVersion});try{return JSON.parse(r)}catch{throw new ne("Unable to JSON.parse response from engine",{clientVersion:this.config.clientVersion})}}convertDatasources(r){let n=Object.create(null);for(let{name:i,url:o}of r)n[i]=o;return n}async loadEngine(){if(!this.engine){this.QueryEngineConstructor||(this.library=await this.libraryLoader.loadLibrary(),this.QueryEngineConstructor=this.library.QueryEngine);try{let r=new WeakRef(this);this.engine=new this.QueryEngineConstructor({datamodel:this.datamodel,env:process.env,logQueries:this.config.logQueries??!1,ignoreEnvVarErrors:!0,datasourceOverrides:this.datasourceOverrides,logLevel:this.logLevel,configDir:this.config.cwd,engineProtocol:this.engineProtocol},n=>{r.deref()?.logger(n)}),ia++}catch(r){let n=r,i=this.parseInitError(n.message);throw typeof i=="string"?n:new Q(i.message,this.config.clientVersion,i.error_code)}}}logger(r){let n=this.parseEngineResponse(r);if(!!n){if("span"in n){this.config.tracingHelper.createEngineSpan(n);return}n.level=n?.level.toLowerCase()??"unknown",Sp(n)?this.logEmitter.emit("query",{timestamp:new Date,query:n.query,params:n.params,duration:Number(n.duration_ms),target:n.module_path}):Ap(n)?this.loggerRustPanic=new ge(this.getErrorMessageWithLink(`${n.message}: ${n.reason} in ${n.file}:${n.line}:${n.column}`),this.config.clientVersion):this.logEmitter.emit(n.level,{timestamp:new Date,message:n.message,target:n.module_path})}}getErrorMessageWithLink(r){return ea({platform:this.platform,title:r,version:this.config.clientVersion,engineVersion:this.versionInfo?.commit,database:this.config.activeProvider,query:this.lastQuery})}parseInitError(r){try{return JSON.parse(r)}catch{}return r}parseRequestError(r){try{return JSON.parse(r)}catch{}return r}on(r,n){r==="beforeExit"?this.beforeExitListener=n:this.logEmitter.on(r,n)}async start(){if(await this.libraryInstantiationPromise,await this.libraryStoppingPromise,this.libraryStartingPromise)return je(`library already starting, this.libraryStarted: ${this.libraryStarted}`),this.libraryStartingPromise;if(this.libraryStarted)return;let r=async()=>{je("library starting");try{let n={traceparent:this.config.tracingHelper.getTraceParent()};await this.engine?.connect(JSON.stringify(n)),this.libraryStarted=!0,je("library started")}catch(n){let i=this.parseInitError(n.message);throw typeof i=="string"?n:new Q(i.message,this.config.clientVersion,i.error_code)}finally{this.libraryStartingPromise=void 0}};return this.libraryStartingPromise=this.config.tracingHelper.runInChildSpan("connect",r),this.libraryStartingPromise}async stop(){if(await this.libraryStartingPromise,await this.executingQueryPromise,this.libraryStoppingPromise)return je("library is already stopping"),this.libraryStoppingPromise;if(!this.libraryStarted)return;let r=async()=>{await new Promise(i=>setTimeout(i,5)),je("library stopping");let n={traceparent:this.config.tracingHelper.getTraceParent()};await this.engine?.disconnect(JSON.stringify(n)),this.libraryStarted=!1,this.libraryStoppingPromise=void 0,je("library stopped")};return this.libraryStoppingPromise=this.config.tracingHelper.runInChildSpan("disconnect",r),this.libraryStoppingPromise}async getDmmf(){await this.start();let r=this.config.tracingHelper.getTraceParent(),n=await this.engine.dmmf(JSON.stringify({traceparent:r}));return this.config.tracingHelper.runInChildSpan({name:"parseDmmf",internal:!0},()=>JSON.parse(n))}version(){return this.versionInfo=this.library?.version(),this.versionInfo?.version??"unknown"}debugPanic(r){return this.library?.debugPanic(r)}async request(r,{traceparent:n,interactiveTransaction:i}){je(`sending request, this.libraryStarted: ${this.libraryStarted}`);let o=JSON.stringify({traceparent:n}),s=JSON.stringify(r);try{await this.start(),this.executingQueryPromise=this.engine?.query(s,o,i?.id),this.lastQuery=s;let a=this.parseEngineResponse(await this.executingQueryPromise);if(a.errors)throw a.errors.length===1?this.buildQueryError(a.errors[0]):new ne(JSON.stringify(a.errors),{clientVersion:this.config.clientVersion});if(this.loggerRustPanic)throw this.loggerRustPanic;return{data:a,elapsed:0}}catch(a){if(a instanceof Q)throw a;if(a.code==="GenericFailure"&&a.message?.startsWith("PANIC:"))throw new ge(this.getErrorMessageWithLink(a.message),this.config.clientVersion);let u=this.parseRequestError(a.message);throw typeof u=="string"?a:new ne(`${u.message}
2023-06-13T18:19:05Z app[17811199a00089] qro [info]
when i created the database and attached i got the following msg:
Now that you've set up Postgres, here's what you need to understand: https://fly.io/docs/postgres/getting-started/what-you-should-know/
Checking for existing attachments
Registering attachment
Creating database
Creating user
Postgres cluster av-db is now attached to av
The following secret was added to av:
DATABASE_URL=postgres://av:c9D26JRXOk6jjvA@av-db.flycast:5432/av?sslmode=disable
The mismatch between qro.av-db.flycast
and av-db.flycast
is weird. Can you try av-db.flycast
instead?
When i launch, i selected dallas, i dont know why the region persists on qro (queretaro)
The builder instance is fine. It is for building your container image on Fly.io.
Apparently Remix is adding qro.
but it shouldn’t. Do you have app/db.server.ts
? If so, can you try the below?
apparently my db.server.ts gets the DATABASE URL from env and i previously set it correctly:
import {PrismaClient} from ‘@prisma/client’
import invariant from ‘tiny-invariant’
let prisma: PrismaClient
declare global {
var db: PrismaClient
}
// this is needed because in development we don’t want to restart
// the server with every change, but we want to make sure we don’t
// create a new connection to the DB with every change either.
// in production we’ll have a single connection to the DB.
if (process.env.NODE_ENV === ‘production’) {
prisma = getClient()
} else {
if (!global.db) {
global.db = getClient()
}
prisma = global.db
}
function getClient() {
const {DATABASE_URL} = process.env
invariant(typeof DATABASE_URL === ‘string’, ‘DATABASE_URL env var not set’)
const databaseUrl = new URL(DATABASE_URL)
const isLocalHost = databaseUrl.hostname === ‘localhost’
const PRIMARY_REGION = isLocalHost ? null : process.env.PRIMARY_REGION
const FLY_REGION = isLocalHost ? null : process.env.FLY_REGION
const isReadReplicaRegion = !PRIMARY_REGION || PRIMARY_REGION === FLY_REGION
if (!isLocalHost) {
databaseUrl.host = ${FLY_REGION}.${databaseUrl.host}
if (!isReadReplicaRegion) {
// 5433 is the read-replica port
databaseUrl.port = ‘5433’
}
}
console.log(🔌 setting up prisma client to ${databaseUrl.host}
)
// NOTE: during development if you change anything in this function, remember
// that this only runs once per server restart and won’t automatically be
// re-run per request like everything else is. So if you need to change
// something in this file, you’ll need to manually restart the server.
const client = new PrismaClient({
datasources: {
db: {
url: databaseUrl.toString(),
},
},
})
// connect eagerly
client.$connect()
return client
}
export {prisma}
You need to make this change to db.server.ts
didnt work, still gets created on qr (quererato)
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.