trippester
trippester
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
localhost on a server should never return "localhost" I'm sure I'll have issues over GC as well but I'll deal with it on the server.
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
Full day spent trying to get this fixed.
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
It's fine. I ultimately need to move this to AWS GovCloud but I hate working with AWS directly in dev.
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
I'm East Coast (NC).
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
That wasn't the issue. It's not hitting the API to execute the login/logout function. It gets the url from the env fine. Also, my page loads are 4x longer now on railway. 5.9seconds vs 1.2 before. I wanted to go server-based since the next feature requires sockets...
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
To each their own. I look for something else.
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
I'm not sure its a user error if the server is the local host serving to a url. The server knows both of these things.
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
Why would it ever go to localhost? I can't figure this out. I've updated the code but to no avail. import { createSupabaseRouteHandlerClient } from '@/lib/utils/getServerSupabaseClient'; import { NextResponse } from 'next/server'; export const dynamic = 'force-dynamic'; export async function POST(request: Request) { const requestUrl = new URL(request.url); const formData = await request.formData(); const email = String(formData.get('email')); const password = String(formData.get('password')); const supabase = createSupabaseRouteHandlerClient(); const { error } = await supabase.auth.signInWithPassword({ email, password, }); // Use BASE_URL if set, otherwise fallback to requestUrl.origin const baseUrl = process.env.BASE_URL || requestUrl.origin; if (error) { return NextResponse.redirect(${baseUrl}/login?error=Could not authenticate user, { // a 301 status is required to redirect from a POST to a GET route status: 301, }); } return NextResponse.redirect(baseUrl, { // a 301 status is required to redirect from a POST to a GET route status: 301, }); } Set the env on railway. Will not correctly direct the user. I know there is a workaround I am missing but I like the idea of the server having this protection built in as a patch if needed.
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
Cool. Let me check that.
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
I did have export const dynamic = 'force-dynamic'; due for vercel to work... import { redirect } from 'next/navigation'; import Header from '@/components/Header'; import NavBar from '@/components/Navbar'; import ClassBanner from '@/components/ClassBanner'; import { getCurrentUser } from '@/lib/utils/getCurrentUser'; // Vercel fails to build if this is not exported export const dynamic = 'force-dynamic'; export default async function MainLayout({ children }: { children: React.ReactNode }) { const currentUser = await getCurrentUser(); if (!currentUser) { redirect('/login'); } return ( <div className="w-full h-full bg-[#1B2026]"> <div className=""> <ClassBanner /> <Header user={currentUser} /> <NavBar /> </div> <div className="w-full h-full pt-[95px] md:pt-[105px]">{children}</div> </div> ); }
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
It's just a redirect to "./" not sure how I can mess that up...
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
Wait, thats the wrong one...
26 replies
RRailway
Created by trippester on 11/13/2023 in #✋|help
Redirect to Localhost?
4caf4458-3b73-4ec2-b116-35df358f1cd1 - Project ID - UPDATED
26 replies