FAQ

Frequently Asked Questions

How to set env variables?

To use env variables in erpc.yaml, follow these steps:

  1. Set env variables: Define the env variables in your system or shell before running your application:
export ETHEREUM_RPC_URL=https://mainnet.infura.io/v3/YOUR_INFURA_KEY
  1. Use placeholders in config: Add placeholders in your config file where you want the env variables to be used:
erpc.yaml
 upstreams:
      - endpoint: ${ETHEREUM_RPC_URL}

How to disable caching?

To disable caching, set evmJsonRpcCache to null in your configuration:

erpc.yaml
database:
  evmJsonRpcCache: ~

How do I set up CORS for frontend usage?

If you’re deploying eRPC on Railway (or elsewhere) and plan to call it directly from a web application in the browser, you must enable CORS in your erpc.yaml. Below is a minimal example that allows requests from a specific origin or any origin:

erpc.yaml
projects:
  - id: main
    cors:
      allowedOrigins: 
        # If you want to allow all origins, use "*" which means any frontend can make calls to your erpc instance
        - "https://myapp.com"
      allowedMethods: 
        - "GET"
        - "POST"
        - "OPTIONS"
      allowedHeaders:
        - "Content-Type"
      allowCredentials: false
      maxAge: 300