next.js
a1f24f20 - Fix: Documentation for custom logs script contract omits required `IMMUTABLE_ASSET_TOKEN:` marker, causing runtime error "Failed to get immutableAssetToken from logs" for users following the docs.

Commit
17 hours ago
Fix: Documentation for custom logs script contract omits required `IMMUTABLE_ASSET_TOKEN:` marker, causing runtime error "Failed to get immutableAssetToken from logs" for users following the docs. This commit fixes the issue reported at docs/01-app/03-api-reference/05-config/01-next-config-js/adapterPath.mdx:233 ## Bug Analysis The `parseIdsFromCliOuput()` method in `test/lib/next-modes/next-deploy.ts` (line 159) unconditionally parses three markers from the logs output: `BUILD_ID:`, `DEPLOYMENT_ID:`, and `IMMUTABLE_ASSET_TOKEN:`. If any of these is missing, it throws an error. This method is called in both custom script code paths: 1. When using `NEXT_TEST_DEPLOY_URL` + `NEXT_TEST_DEPLOY_LOGS_SCRIPT_PATH` (line 223) 2. When using `NEXT_TEST_DEPLOY_SCRIPT_PATH` + `NEXT_TEST_DEPLOY_LOGS_SCRIPT_PATH` (line 260) The documentation at line ~247 only lists `BUILD_ID:` and `DEPLOYMENT_ID:` as required markers. The example deploy script similarly only writes those two markers to `.adapter-build.log`. Any user following the documented contract will get a runtime error: `"Failed to get immutableAssetToken from logs"` because `IMMUTABLE_ASSET_TOKEN:` is absent from the logs output. The code does handle the special value `"undefined"` (converting it to actual `undefined`), so adapters that don't produce an immutable asset token can output `IMMUTABLE_ASSET_TOKEN: undefined`. ## Fix 1. Added `IMMUTABLE_ASSET_TOKEN:` to the required markers list in the "Custom logs script contract" section, with a note that the value `undefined` should be used if the adapter doesn't produce one. 2. Added `IMMUTABLE_ASSET_TOKEN` variable and its `echo` line to the example deploy script that writes `.adapter-build.log`, defaulting to `"undefined"` with a comment explaining the usage. Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com> Co-authored-by: ijjk <jj@jjsweb.site>
Author
Parents
Loading