Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ npm install -g @aws/agentcore
agentcore --version
```

### agentcore deploy fails with `Target "default" not found in aws-targets.json`

Some agentcore CLI versions scaffold `<project>/agentcore/aws-targets.json` as an empty list, which makes `agentcore deploy` exit before the CDK synth. The `deploy_payment_agent.py` script appends a `default` entry automatically when it sees this. If you ran `agentcore deploy` directly, write the file by hand and re-run:
```bash
echo '[{"name":"default","account":"<account-id>","region":"<region>"}]' > PaymentAgent/agentcore/aws-targets.json
```

### Deploy fails with CDK bootstrap error

Bootstrap CDK in your account/region first:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,27 @@

print("pyproject.toml updated")

# Some agentcore CLI versions scaffold aws-targets.json as an empty list,
# which causes `agentcore deploy` to exit with `Target "default" not found
# in aws-targets.json`. Append a default target if one is missing, and leave
# any other entries alone.
targets_file = os.path.join(project_dir, "agentcore", "aws-targets.json")
if os.path.exists(targets_file):
try:
with open(targets_file) as f:
targets = json.loads(f.read() or "[]")
except json.JSONDecodeError:
targets = None
if (
isinstance(targets, list)
and all(isinstance(t, dict) and "name" in t for t in targets)
and not any(t["name"] == "default" for t in targets)
):
targets.append({"name": "default", "account": account_id, "region": REGION})
with open(targets_file, "w") as f:
f.write(json.dumps(targets, indent=2))
print(f"Added default target to aws-targets.json (account={account_id}, region={REGION})")

# ── Step 7: Deploy to AgentCore Runtime ───────────────────────────────────────
print("\n── Step 7: Deploy to AgentCore Runtime ──")
print("This creates billable AWS resources (Lambda, CloudWatch, API Gateway).")
Expand Down
Loading