Skip to content

Add first render example - #10

Open
musab123-afk wants to merge 4 commits into
shotstack:masterfrom
musab123-afk:add-first-render-example
Open

Add first render example#10
musab123-afk wants to merge 4 commits into
shotstack:masterfrom
musab123-afk:add-first-render-example

Conversation

@musab123-afk

@musab123-afk musab123-afk commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

The very basics of the Shotstack API, and the loop every other example in this cookbook builds on: submit an Edit, poll the render status, and print the output URL, implemented in both Node.js and Python. Companion code for https://shotstack.io/learn/render-your-first-video-shotstack-api/. Verified end-to-end on the sandbox in both languages; failure paths print one actionable line and exit non-zero per STANDARDS.md, and prettier/ruff pass with the repo configs.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

@musab123-afk is attempting to deploy a commit to the dazzatron Team on Vercel.

A member of the Team first needs to authorize it.

@dazzatronus

Copy link
Copy Markdown
Contributor

#13 changed STANDARDS.md after you opened this. .env.example values, Python exception handling, check 5. Two came from reading this PR. Rebase for the new text.

Ran both scripts end to end against stage. Both render, both poll, both return a playable mp4. Missing-key path prints the same clean line in both languages. That's the one users hit.

Rule Status
CI (prettier + ruff) pass
README commands work, in sequence pass
README: 5 sections, in order pass
Missing API key prints one actionable line pass
.env.example values empty fail (new in #13)
README says how to load .env fail (new in #13)
Requirements lists each tool and its minimum version fail
No stack traces fail
One actionable line per failure fail
Two-language files agree fail

Two stack traces. Both Python.

render.py:44 — null JSON body. AttributeError: 'NoneType' object has no attribute 'get'. Reproduced against a local stub returning null with HTTP 200. render.mjs uses ?. and survives.

render.py:99 — Ctrl-C during the ten-minute poll. KeyboardInterrupt is a BaseException. The tuple can't catch it.

One line fixes both:

except (Exception, KeyboardInterrupt) as error:

Shorter than the six classes it replaces. TimeoutError and requests.RequestException are already OSError subclasses.

Network failure says nothing useful.

Reproduced against an unresolvable host.

Python: HTTPSConnectionPool(host=..., port=443): Max retries exceeded with url: /edit/stage/render (Caused by NameResolutionError(...))

Node: fetch failed. Cause sits in error.cause. Never read.

Failures names this as one of the three.

Rejected key dumps the envelope.

Live 403, both languages:

Shotstack returned 403 Forbidden: {"errors":[{"status":"403","title":"Forbidden","detail":"Invalid or disabled API key. Please check your API key is entered correctly for the 'stage' stage and your account is active."}]}

The line you want is errors[0].detail. render.mjs:37, render.py:36.

Languages disagree on a done render with no url.

Python raises KeyError. Stderr shows 'url'. Node prints undefined, exits 0.

Smaller

  • .env.example — blank the value. URL as a comment above. README already uses export. Needs one line pointing at the file.
  • README.md:13 — no Python or requests floor. JSONDecodeError needs requests >= 2.27. Older raises AttributeError from the except clause itself.
  • Timeout message hardcodes "10 minutes". Value lives in MAX_WAIT_MS / MAX_WAIT_SECONDS.
  • .gitignore lists node_modules/. No package.json here.
  • render.mjs:4, render.py:9 — URL says stage. Prose says sandbox. The 403 body says stage. One comment each.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants