You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you use Arcjet within a Gatsby function, the Arcjet client does not pick up any environment variables.
This means that when running locally, it will always log the ✦Aj WARN Client IP address is missing. If this is a dev environment set the ARCJET_ENV env var to "development" warning and fail to build the characteristics with ✦Aj ERROR Failed to build fingerprint. Please verify your Characteristics. because it can't find a valid IP address.
I am able to access the environment variables from within the function so I can set process.env.ARCJET_KEY with a normal instantiation of the client. I tried placing the client inside and outside of the handler, but it still seems unable to detect the environment variables. A console.log shows they are all set.
As a workaround I can hard code the local IP if we detect we're in development:
warn ✦Aj WARN Client IP address is missing. If this is a dev environment set the ARCJET_ENV env var to "development"
Executed function "/api/arcjet" in 5ms
ERROR UNKNOWN
✦Aj ERROR Failed to build fingerprint. Please verify your Characteristics.
error: {}
IP Address ::1
Arcjet ENV development
The text was updated successfully, but these errors were encountered:
If you use Arcjet within a Gatsby function, the Arcjet client does not pick up any environment variables.
This means that when running locally, it will always log the
✦Aj WARN Client IP address is missing. If this is a dev environment set the ARCJET_ENV env var to "development"
warning and fail to build the characteristics with✦Aj ERROR Failed to build fingerprint. Please verify your Characteristics.
because it can't find a valid IP address.I am able to access the environment variables from within the function so I can set
process.env.ARCJET_KEY
with a normal instantiation of the client. I tried placing the client inside and outside of the handler, but it still seems unable to detect the environment variables. Aconsole.log
shows they are all set.As a workaround I can hard code the local IP if we detect we're in development:
Here's a simple Gatsby function demonstrating the issue. It can be placed in
src/api/arcjet.ts
to be accessed fromhttp://localhost:8000/api/arcjet
The output is:
The text was updated successfully, but these errors were encountered: