Skip to content

fix: correct signup example environment variable reading #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/signup/test/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { formSchema } from "@/app/signup/schema";
import arcjet, { protectSignup, shield } from "@/lib/arcjet";
import arcjet, { ARCJET_ENV, protectSignup, shield } from "@/lib/arcjet";
import { NextRequest, NextResponse } from "next/server";
import ip from "@arcjet/ip";

Expand Down Expand Up @@ -59,8 +59,7 @@ export async function POST(req: NextRequest) {
// Next.js 15 doesn't provide the IP address in the request object so we use
// the Arcjet utility package to parse the headers and find it. If we're
// running in development mode, we'll use a local IP address.
const userIp =
process.env.ARCJET_ENV === "development" ? "127.0.0.1" : ip(req);
const userIp = ARCJET_ENV === "development" ? "127.0.0.1" : ip(req);
// The protect method returns a decision object that contains information
// about the request.
const decision = await aj.protect(req, { fingerprint: userIp, email });
Expand Down