C.f. bug report in astro's repository.
Contains an Astro "Basics" starter kit installation updated to reproduce the reported bug.
Running in node.js v16
git clone git@github.com:mef/astro-fetch-in-endpoint-issue.git
cd astro-fetch-in-endpoint-issue
npm install
npm run build; npm run preview
Preview server starts
Process crashes with the following error message:
const response = await fetch('https://www.mediawiki.org/w/api.php?action=opensearch&search=example');
^
ReferenceError: fetch is not defined