Why am i constantly getting this error when trying...
# ask-ai
w
Why am i constantly getting this error when trying to deploy my agent to agent cloud using "lk agent deploy --config=path/to/my/livekit.toml"? Using api-key, api-secret from environment invalid project URL [http://localhost:7880]
t
Thanks for reaching out, Alex. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like the error is happening because the URL
http://localhost:7880
is meant for local development with a self-hosted LiveKit server, and it doesn’t quite match the format expected for LiveKit Cloud deployments. No worries—we can get this sorted out together! Here’s how you can fix it: 1. First, run
lk cloud auth
to authenticate with LiveKit Cloud and bring in your project settings. This step will automatically set up the CLI with the correct
wss://
URL, API key, and secret. 2. Next, double-check your configuration by listing your projects with
lk project list
. You should see a valid LiveKit Cloud project URL that looks like
wss://your-subdomain.livekit.cloud
. 3. If you need to, you can set the right project as your default by running
lk project set-default <project-name>
. If you prefer, you can also add a LiveKit Cloud project manually using this command:
Copy code
lk project add <project_name> --url <livekit_url> --api-key <api_key> --api-secret <api_secret> [--default]
Just make sure the URL starts with
wss://
and includes the correct subdomain. Once you have the right project set up, go ahead and try deploying the agent again. If you run into any more bumps, I’m here to help! Sources: cmd/lk/agent.go | Docs::Home | Connecting to LiveKit | LiveKit Docs | Docs::Home | LiveKit CLI project management | LiveKit Docs
w
Why is it saying "Using api-key, api-secrete from environment" when I don't have those in my environment? I'm expecting it to use my lk cli's creds to push things. I have the correct subdomain in my .toml file and i'm providing it via the --config flag
t
Hi there! I’d love to help you understand how the LiveKit CLI handles API keys and secrets. It uses environment variables because they take priority in its configuration system, which helps keep things secure and consistent. Even if you use the
--config
flag to point to a
.toml
file, any API key or secret set in your environment (like
LIVEKIT_API_KEY
and
LIVEKIT_API_SECRET
) will override what’s in that config file. This is by design, to make sure sensitive credentials are always prioritized safely. If you’d prefer the CLI not to use those environment variables, just make sure
LIVEKIT_API_KEY
and
LIVEKIT_API_SECRET
aren’t set in your environment. You can easily check by running
env | grep LIVEKIT
on Unix-based systems, or by looking at your environment variables in your system settings. Once those are cleared, the CLI will happily use the credentials from your
.toml
file instead. I hope this helps clarify things! If you have any more questions, feel free to ask—I’m here for you. Sources: LiveKit CLI | livekit/livekit_composite | DeepWiki | Accepting incoming calls | LiveKit Docs | Accepting incoming calls | LiveKit Docs | Worker options | LiveKit Docs | Secrets management | LiveKit Docs