Corrigindo ordem de carregamento do dotenv para evitar erro de credenciais no Supabase
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
import type { VercelRequest, VercelResponse } from '@vercel/node';
|
||||
import app from './app.js';
|
||||
import { connectDB } from '../src/server/config/database.js';
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -68,7 +68,7 @@
|
||||
"vite-plugin-pwa": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.12.0"
|
||||
"node": ">=20.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@alloc/quick-lru": {
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
const supabaseUrl = process.env.SUPABASE_URL || 'https://supabase.reifonas.cloud';
|
||||
const supabaseServiceKey = process.env.SUPABASE_SERVICE_ROLE_KEY || 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJPbmxpbmUgSldUIEJ1aWxkZXIiLCJpYXQiOjE3NDYwMTMyMDAsImV4cCI6MTc3NzU0OTIwMCwiYXNkIjoidHJ1ZSIsInN1YiI6ImFkbW10cmFja3N0ZWVsIn0.H4ZcZI3kaZclQJlRj3a3b0VbVrL3R2GzT8l5t5jL3Yc';
|
||||
const supabaseServiceKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
|
||||
|
||||
if (!supabaseServiceKey) {
|
||||
throw new Error('❌ SUPABASE_SERVICE_ROLE_KEY is missing in environment variables');
|
||||
}
|
||||
|
||||
export const supabase = createClient(supabaseUrl, supabaseServiceKey, {
|
||||
db: {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import app from './app.js';
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
import app from './app.js';
|
||||
import { connectDB } from './config/database.js';
|
||||
import { notificationService } from './services/notificationService.js';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const startServer = async () => {
|
||||
try {
|
||||
await connectDB();
|
||||
|
||||
Reference in New Issue
Block a user