AUTH_PK not found in the environment!
loraoliva
PROOP

10 months ago

I have this error:
Error: AUTH_PK not found in the environment! Make sure you have set the AUTH_PK variable.
Here's a summary of the situation and troubleshooting steps taken:

  1. Variable Configuration: The environment variable AUTH_PK is correctly defined and sealed in our Railway service settings. Its name is exactly AUTH_PK.

  2. Code Access: The application code (in src/config.ts) attempts to access this variable using the standard process.env.AUTH_PK.

  3. Recent Change Trigger: This issue started occurring after I edited a different (optional) environment variable (MANUAL_LUCKY_WINNER) and then re-deployed the service.

  4. Test with Non-Sealed Variable: As a test, I configured the application to read a new, non-sealed environment variable (e.g., TEST_VAR) with a simple test value. The application successfully read this TEST_VAR. (It then failed later with an Error: bad secret key size as expected, because the test value wasn't a valid Solana secret key, but this proved the script can read non-sealed environment variables).

  5. Issue Persists with Sealed AUTH_PK: When I revert the code to read the sealed AUTH_PK variable (which contains a valid Solana secret key), the AUTH_PK not found error returns immediately upon application start.

  6. Troubleshooting Attempts: I have tried full rebuilds, re-deploys, and have double-checked the variable name and scope. The Build Logs do not show any errors or warnings related to environment variable injection for AUTH_PK.

This behavior suggests that there might be an issue with how Railway is currently exposing or injecting this specific sealed environment variable (AUTH_PK) to the application's runtime environment after the recent changes and re-deployments. Non-sealed variables seem to be working correctly.

Could you please investigate why the sealed AUTH_PK variable might not be accessible to the application at runtime?

Relevant IDs (if helpful):

  • Deployment ID where error occurs: d6ce4c7b-016e-41f7-8edb-b4b195d3347d

  • Replica ID: 78e2a2ca-45d6-40a2-bc2a-0e54b0695549

Thank you for your assistance.

Solved

6 Replies

10 months ago

Hello,

You added that variable but you never deployed the changes, please click the Deploy button at the top of your canvas to deploy the changes.

Best,
Brody


Status changed to Awaiting User Response Railway 10 months ago


loraoliva
PROOP

10 months ago

I deployed, re deployed and restarted!


Status changed to Awaiting Railway Response Railway 10 months ago


loraoliva
PROOP

10 months ago

/app/src/config.ts:8

throw new Error(

^

Error: AUTH_PK not found in the environment! Make sure you have set the AUTH_PK variable.

at getEnvVariable (/app/src/config.ts:8:11)

at Object.<anonymous> (/app/src/config.ts:25:12)

at Module._compile (node:internal/modules/cjs/loader:1364:14)

at Module.m._compile (/app/node_modules/ts-node/src/index.ts:1618:23)

at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)

at Object.require.extensions.<computed> [as .ts] (/app/node_modules/ts-node/src/index.ts:1621:12)

at Module.load (node:internal/modules/cjs/loader:1203:32)

at Function.Module._load (node:internal/modules/cjs/loader:1019:12)

at Module.require (node:internal/modules/cjs/loader:1231:19)

at require (node:internal/modules/helpers:177:18)


10 months ago

You have set AUTH_PK to an empty value.


Status changed to Awaiting User Response Railway 10 months ago


loraoliva
PROOP

10 months ago

No buddy! AUTH_PK is sealed from start, it was working before


Status changed to Awaiting Railway Response Railway 10 months ago


10 months ago

Yes AUTH_PK is sealed, it is a sealed empty variable, I suggest deleting it, and then setting it again with a valid value.


Status changed to Awaiting User Response Railway 10 months ago


Railway
BOT

7 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 7 months ago


Loading...