Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion flash/apps/local-testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,22 @@ flash run --auto-provision

**Authentication errors**

Ensure `RUNPOD_API_KEY` is set in your `.env` file or environment:
Run `flash login` to authenticate:

```bash
flash login
```

Alternatively, set `RUNPOD_API_KEY` as an environment variable or in your `.env` file:

```bash
export RUNPOD_API_KEY="your_api_key_here"
```

<Note>
Values in your `.env` file are only available locally for CLI commands. They are not passed to deployed endpoints.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Citation: Based on PR #39 which clarifies .env scope for local development. Added flash login as recommended auth fix per the PR guidance.
View source

</Note>

## Next steps

- [Deploy to production](/flash/apps/deploy-apps) when your app is ready.
Expand Down
10 changes: 7 additions & 3 deletions flash/cli/login.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,20 @@ Instead of using `flash login`, you can set your API key directly as an environm
export RUNPOD_API_KEY=your_api_key_here
```

Or add it to your project's `.env` file:
Or add it to your project's `.env` file for local CLI use:

```bash
RUNPOD_API_KEY=your_api_key_here
```

You can generate an API key with the correct permissions from [Settings > API Keys](https://www.runpod.io/console/user/settings) in the Runpod console.
Generate an API key from [Settings > API Keys](https://www.runpod.io/console/user/settings) in the Runpod console.

<Warning>
Your Runpod API key needs **All** access permissions to your Runpod account.
Values in your `.env` file are only used for local CLI commands and development. They are **not** passed to deployed endpoints. To set environment variables on deployed endpoints, use the `env` parameter in your endpoint configuration. See [Endpoint parameters](/flash/configuration/parameters#env) for details.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Citation: Based on PR #39 which clarifies that .env files only populate os.environ for local CLI use—they are not carried to deployed endpoints. Key files: docs/cli/getting-started.md, docs/cli/workflows.md.
View source

</Warning>

<Warning>
Your Runpod API key needs **All** access permissions.
</Warning>


Expand Down
18 changes: 18 additions & 0 deletions flash/configuration/parameters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,24 @@ async def load_model():
...
```

<Warning>
Values in your project's `.env` file are only available locally for CLI commands and development. They are **not** passed to deployed endpoints. You must declare environment variables explicitly using the `env` parameter.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Citation: Based on PR #39 which documents the pattern env={"KEY": os.environ["KEY"]} to pass local env vars to deployed endpoints. Key files: docs/cli/commands.md, docs/cli/workflows.md.
View source

</Warning>

To pass a local environment variable to your deployed endpoint, read it from `os.environ`:

```python
import os

@Endpoint(
name="ml-worker",
gpu=GpuGroup.ANY,
env={"HF_TOKEN": os.environ["HF_TOKEN"]} # Read from local env, pass to workers
)
async def load_model():
...
```

<Note>
Environment variables are excluded from configuration hashing. Changing environment values won't trigger endpoint recreation, making it easy to rotate API keys.
</Note>
Expand Down
18 changes: 14 additions & 4 deletions flash/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,29 @@ RUNPOD_API_KEY environment variable is required but not set

1. Generate an API key from [Settings > API Keys](https://www.runpod.io/console/user/settings) in the Runpod console. The key needs **All** access permissions.

2. Set the key using one of these methods:
2. Authenticate using one of these methods:

**Option 1: Environment variable**
**Option 1: Use `flash login` (recommended)**
```bash
flash login
```
Opens your browser for authentication and saves your credentials.

**Option 2: Environment variable**
```bash
export RUNPOD_API_KEY="your_api_key"
```

**Option 2: .env file in your project root**
**Option 3: .env file for local CLI use**
```bash
echo "RUNPOD_API_KEY=your_api_key" > .env
```

**Option 3: Add to your shell profile (`~/.bashrc` or `~/.zshrc`) for global authorization**
<Note>
Values in your `.env` file are only available locally for CLI commands. They are not passed to deployed endpoints.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Citation: Based on PR #39 which recommends flash login as primary auth method and clarifies .env scope. Key files: docs/cli/troubleshooting.md, docs/cli/getting-started.md.
View source

</Note>

**Option 4: Shell profile for persistent local access**
```bash
echo 'export RUNPOD_API_KEY="your_api_key"' >> ~/.bashrc
source ~/.bashrc
Expand Down
Loading