Medim
Medim
Explore posts from servers
NNuxt
Created by Medim on 5/7/2024 in #❓・help
Encoding a bit off on createError?
No description
38 replies
NNuxt
Created by Medim on 5/1/2024 in #❓・help
Use prisma globally in api routes
I have a question, is it possible to use the prisma client globally without having to import it everytime? I'm using Prisma + Turso so there's a bit more than just two lines of code to use the prisma client so adding it to every api file is a bit tiring, is there a way to make it available as a util/helper globally? what is the best way to do it?
import { PrismaClient } from "@prisma/client"
const libsql = createClient({
url: `${tursoDatabaseUrl}`,
authToken: `${tursoAuthToken}`,
})

const adapter = new PrismaLibSQL(libsql)
const prisma = new PrismaClient({ adapter })
import { PrismaClient } from "@prisma/client"
const libsql = createClient({
url: `${tursoDatabaseUrl}`,
authToken: `${tursoAuthToken}`,
})

const adapter = new PrismaLibSQL(libsql)
const prisma = new PrismaClient({ adapter })
4 replies
NNuxt
Created by Medim on 4/12/2024 in #❓・help
Using a custom font results in a large blank space beneath placeholders
No description
2 replies
NNuxt
Created by Medim on 4/11/2024 in #❓・help
How can I setup this font using nuxt/fonts
No description
8 replies
NNuxt
Created by Medim on 4/6/2024 in #❓・help
Nuxtr always fails to update dependencies
If I use Nuxtr to update a dependency, it will fail. But If I click on "Install Manually" it goes through without a problem, what could it be? I'm using Yarn 4.0 and its specified on package.json
1 replies
NNuxt
Created by Medim on 2/20/2024 in #❓・help
Can't find auto import in slug route
No description
12 replies
RRailway
Created by Medim on 9/26/2023 in #✋|help
Issues while publishing template
No description
40 replies
RRailway
Created by Medim on 7/13/2023 in #✋|help
Need some explanation on templates
Hi there! I'm working on multiple templates (mainly CMS's) for railway, and I saw that some templates are maintained on a Railway repo (https://github.com/railwayapp-templates) and some are user hosted (mine is user hosted), why? Is it because some templates are widely used and would be better assigned to a railway team member to maintain it? Or is there a way I can put my templates there too?
12 replies
RRailway
Created by Medim on 7/6/2023 in #✋|help
Railway isn't building/changing to the dev branch
19 replies
RRailway
Created by Medim on 5/22/2023 in #✋|help
My API can't read env vars
61 replies
RRailway
Created by Medim on 3/27/2023 in #✋|help
Issue with env vars using webpack
Hi there! I'm trying to deploy a Vue2 project using vue-cli. To access my env vars on client-side code i need to use process.env.VUE_APP_MYVAR But on railway, everything returns undefined? Its gets my process.env.NODE_ENV var, but it doesnt get my other vars. Tried using webpack-dotenv to expose system vars too, but the rest of my vars still undefined.
const Dotenv = require('dotenv-webpack');
new Dotenv({
systemvars: true
}),
const Dotenv = require('dotenv-webpack');
new Dotenv({
systemvars: true
}),
What could it be? Webpack messing it up? On AWS worked fine.
4 replies
RRailway
Created by Medim on 3/20/2023 in #✋|help
Issues using Nginx to reverse proxy
Hey there! I'm in the process of migrating some of my company projects to Railway but i'm having some issues setting up PHP-FPM. PHP-FPM needs a nginx reverse proxy with Fastcgi to be able to serve files. Ok... I did that! My PHP-FPM is live and accepting connections, I generated a domain and directed Nginx to it. My API also is able to reach Nginx just fine. The flow is simple: API -> NGINX -> PHP-FPM API But currently, all my requests time out at the PHP-FPM API. Log from Nginx:
2023/03/20 18:12:05 [error] 30#30: *23 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.4, server: safe-branch-production.up.railway.app, request: "POST /nfe/valid/nfce HTTP/1.1", upstream: "fastcgi://104.196.232.237:9000", host: "safe-branch-production.up.railway.app"
192.168.0.4 - - [20/Mar/2023:18:12:05 +0000] "POST /nfe/valid/nfce HTTP/1.1" 504 167 "-" "axios/0.19.2" "34.127.13.232"
2023/03/20 18:12:05 [error] 30#30: *23 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.4, server: safe-branch-production.up.railway.app, request: "POST /nfe/valid/nfce HTTP/1.1", upstream: "fastcgi://104.196.232.237:9000", host: "safe-branch-production.up.railway.app"
192.168.0.4 - - [20/Mar/2023:18:12:05 +0000] "POST /nfe/valid/nfce HTTP/1.1" 504 167 "-" "axios/0.19.2" "34.127.13.232"
This is my default.conf file:
server {
listen 8080;
server_name safe-branch-production.up.railway.app;
root /var/www/html;
# pass the PHP scripts to FastCGI server

location / {
try_files $uri $uri/ /public/index.php?q=$uri&$args;
}

location ~ \.php$ {
fastcgi_pass gerenciei-api-nfe-production.up.railway.app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 8080;
server_name safe-branch-production.up.railway.app;
root /var/www/html;
# pass the PHP scripts to FastCGI server

location / {
try_files $uri $uri/ /public/index.php?q=$uri&$args;
}

location ~ \.php$ {
fastcgi_pass gerenciei-api-nfe-production.up.railway.app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}
}
(I will regenerate domains after this get fixed so no worries) What could it be?
438 replies
NNuxt
Created by Medim on 12/9/2022 in #❓・help
When to use composables
quick question, when to use composables? In my project im creating an axios instance in a composable, is it correct?
1 replies
NNuxt
Created by Medim on 12/2/2022 in #❓・help
Nuxt 3 not importing component on subfolder
No description
3 replies
NNuxt
Created by Medim on 12/1/2022 in #❓・help
CSS not importing on vuetify plugin.
No description
4 replies
RRailway
Created by Medim on 9/18/2022 in #✋|help
Bug while deploying templates
Hi there! was about to record a video to get some examples for a feature request i'm about to do and encoutered this error, while railway is setting up your template you can't access settings and if you do, it'll crash the deployment???
4 replies
RRailway
Created by Medim on 9/17/2022 in #✋|help
Error deleting template.
8 replies
RRailway
Created by Medim on 9/9/2022 in #✋|help
Vercel vs Railway
What is the difference between hosting a website on railway and on vercel?
10 replies
RRailway
Created by Medim on 8/29/2022 in #✋|help
MySQL query error
30 replies
RRailway
Created by Medim on 8/23/2022 in #✋|help
Reference variables between services
Just wondering... is it possible to reference a variable on my postgresql service (DB_HOST, DB_PORT...) on my other web service variables? like: ${{ DB_HOST }}
20 replies