Loading...
Loading...
Verifies a Taubyte Go function locally via the `taubyte/go-wasi` Docker recipe (preferred over `tau build`, with tmpfs+bind-mount-ro to avoid root-owned artifacts in the source tree), and verifies a function actually serves on Dream by curling the gateway with the right `Host:` header (plus `/etc/hosts` mapping for `*.localtau`). Use when locally compiling a Go function to WASM, when smoke-testing a function before pushing, or when probing a Dream-hosted HTTP function from the laptop.
npx skill4agent add taubyte/skills verifying-taubyte-functions*.localtautau build| Goal | Use this section |
|---|---|
| Compile WASM locally to confirm the source builds | "Local Go WASM verify (Docker)" below |
| Hit a function running on Dream | "Runtime verification (Dream gateway)" below |
tau buildgo.sumlib/main.gogo.mod.gocd <project>/code/functions/<fn>
mkdir -p out
docker run --rm \
-e CODE=/src \
-e GOPROXY=https://proxy.golang.org,direct \
-e GOSUMDB=sum.golang.org \
-v "$(pwd)/out:/out" \
--mount type=bind,src="$(pwd)",dst=/src_ro,ro \
--mount type=tmpfs,dst=/src \
taubyte/go-wasi:latest /bin/bash -lc '
set -euo pipefail
rsync -a --delete /src_ro/ /src/ 2>/dev/null || cp -a /src_ro/. /src/
cd /src
export CODE=/src
# go-wasi:latest: go/tinygo live under /usr/local/* but are often missing from PATH in non-login shells (same class of env Dream uses when running build.sh).
export PATH="/usr/local/go/bin:/usr/local/tinygo/bin:${PATH}"
source /utils/wasm.sh
ls -la /out
'--mount type=bind,...,ro--mount type=tmpfs,dst=/src/srcrsyncout/taubyte/go-wasi$(pwd):/srclib/main.gogit statustau push.taubyte/config.yamltaubyte/go-wasi:latesttaubyte/go-wasi:v2-itcannot attach stdin to a TTY-enabled container-ittaubyte/go-wasi:latestPATHgotinygo/usr/local/go/bin/usr/local/tinygo/bin.taubyte/build.shPATH/utils/wasm.shgo: command not foundPATHexport.taubyte/build.sh. /utils/wasm.shout/out/# 1. Discover gateway port
# `dream status gateway` often prints a blank line before `@ http://...`; awk '/@ http/{print $3}' can return empty — prefer:
GW=$(dream status gateway default | grep -Eo 'http://[0-9.]+:[0-9]+' | head -n1)
# 2. Read the function's FQDN from its domain YAML
FQDN=$(awk '/^fqdn:/{print $2; exit}' config/domains/<domain>.yaml)
# 3. Curl with Host header
curl -i -H "Host: $FQDN" "$GW/<path>"ping_pong/pingcurl -i -H "Host: <random>.default.localtau" "http://127.0.0.1:<gateway_port>/ping"
# Expected: HTTP 200 and body "PONG"*.localtauHost:http://<fqdn>/<path>sudo sh -c 'echo "127.0.0.1 <random>.default.localtau" >> /etc/hosts'
# or edit /etc/hosts manually:
# 127.0.0.1 <random>.default.localtauhttp://<random>.default.localtau:<gateway_port>/<path>awk '/^fqdn:/{print $2; exit}' config/domains/<domain>.yamlSmoke check progress:
- [ ] cd into function root (has go.mod)
- [ ] Run Docker WASM build recipe (above)
- [ ] Confirm out/ contains expected artifacts
- [ ] Inspect container stdout for errors
- [ ] If green, proceed to pushRuntime check progress:
- [ ] dream status gateway <universe> -> note port (use grep -Eo 'http://[0-9.]+:[0-9]+' if awk returns empty)
- [ ] Read FQDN from config/domains/<domain>.yaml
- [ ] curl -i -H "Host: <fqdn>" http://127.0.0.1:<port>/<path>
- [ ] Expect HTTP 200 + expected body
- [ ] If non-200, see diagnosing-dream-builds for build/log inspectiontau buildlib/main.goartifact.zipgit rm --cached.gitignoreHost:Host:404Hostno substrate match found-H "Host: <fqdn>:<gateway_port>"dream status gateway127.0.0.1inspecting-dream-statustriggering-dream-buildsdiagnosing-dream-buildsbuilding-taubyte-websitesHost: