-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Hi! I'm having multiple issues with the Try It Now runners (TypeScript, Python, and Curl). All three runners fail differently, so I'll summarize my setup and the symptoms.
Setup
I'm using @speakeasy-api/docs-md with the following configuration:
/** @type {import("@speakeasy-api/docs-md").Settings} */
export default {
spec: OPENAPI_YAML,
output: {
pageOutDir: './src/app/(api)/api',
framework,
aboutPage: false,
generateRequestBodyExamples: true,
generateResponseExamples: true,
},
display: {
visibleResponses: 'success',
expandTopLevelPropertiesOnPageLoad: false,
},
codeSamples: [
{
language: 'typescript',
sdkFolder: './sdks/client-ts-1.10.0',
tryItNow: {
outDir: './public/try-it-now',
urlPrefix: '/try-it-now',
},
},
{
language: 'python',
sdkFolder: './sdks/client-python-1.9.11',
tryItNow: {
outDir: './public/try-it-now',
urlPrefix: '/try-it-now',
},
},
{
language: 'curl',
tryItNow: true,
},
],
};Problems
1. TypeScript Runner Stuck at “typescript:compiling”
The TS runner never progresses and stays forever in:
{
"type": "typescript",
"status": {
"state": "typescript:compiling",
"previousEvents": []
}
}No console errors are shown.
It feels like the bundler or sandbox isn't finishing compilation.
2. Python Runner — 401 Error + Unsafe Headers blocked in Pyodide
The Python runner crashes with:
{
"type": "python",
"status": {
"state": "python:executing",
"events": [
{
"type": "python:execution:uncaught-exception",
"error": {
"message": "API error occurred... Bearer token not found"
}
}
]
}
}Browser console logs:
Refused to set unsafe header "host"
Refused to set unsafe header "accept-encoding"
Refused to set unsafe header "connection"
Refused to set unsafe header "content-length"
It looks like the Python SDK makes an HTTP request where Pyodide tries to set disallowed headers, causing the auth header never to be sent → resulting in a 401.
3. Curl Runner — API returns 422 due to serialized body
The generated curl command:
curl https://api.mistral.ai/v1/chat/completions \
-X POST \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-d '{
"messages": [
{
"content": "ipsum eiusmod",
"role": "user"
}
],
"model": "mistral-medium-latest"
}'This returns:
{
"type": "curl",
"status": {
"state": "curl:error",
"events": [
{
"type": "curl:fetch:error",
"error": {
"message": "API error occurred: Status 422 ... Input should be a valid dictionary"
}
}
]
}
}If I POST with -H "Content-Type: application/json" everything works, so it seems the Try It Now curl content or runner isn't setting a default Content-Type
Summary
TS runner never finishes compiling
Python runner fails because Pyodide blocks unsafe headers
Curl runner appears to be missing Content-Type: application/json or may be encoding payload incorrectly
If you need a minimal repro or a zip of the generated /public/try-it-now folder, I can provide it.