-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Astro Info
Astro v5.12.3
Node v22.14.0
System macOS (arm64)
Package Manager npm
Output server
Adapter @astrojs/netlify
Integrations @astrojs/tailwind
@astrojs/react
If this issue only occurs in one browser, which browser is a problem?
N/A, it's a build issue
Describe the Bug
The Netlify deployment fails with TypeError: serverEntrypointModule[_start] is not a function
Root Cause: The generated entry.mjs file contains code that tries to call serverEntrypointModule[_start](_manifest, _args)
where _start = 'start'
, but the serverEntrypointModule doesn't export a start function from what I can tell spelunkering through my .netlify folder
Things I've done so far:
- Updated adapter import from @astrojs/netlify to @astrojs/netlify/functions
- Cleared build cache and rebuilt multiple times
- Switched back to default import @astrojs/netlify (auto-detection)
- I've also redeployed clearing the build cache and the same issue persists.
Current State
- ran npx @astrojs/upgrade
- Astro 5.12.3 with @astrojs/netlify 6.5.3
- Build generates problematic code in .netlify/build/entry.mjs lines 47-50
- Works locally but fails on Netlify deployment
In the meantime, I'm going to see if downgrading the adapter that's still compatible with Astro v5
You can pull down the code from my repo on this branch, astro-5-upgrade
, https://github.com/nickytonline/nickyt.live/tree/astro-5-upgrade
Jul 27, 10:43:15 AM: ERROR Uncaught Exception {"errorType":"TypeError","errorMessage":"serverEntrypointModule[_start] is not a function","stack":["TypeError: serverEntrypointModule[_start] is not a function"," at file:///var/task/.netlify/build/entry.mjs:49:32"," at ModuleJob.run (node:internal/modules/esm/module_job:274:25)"," at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)"," at async _tryAwaitImport (file:///var/runtime/index.mjs:1030:16)"," at async _tryRequire (file:///var/runtime/index.mjs:1079:86)"," at async _loadUserApp (file:///var/runtime/index.mjs:1103:16)"," at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1148:21)"," at async start (file:///var/runtime/index.mjs:1332:23)"," at async file:///var/runtime/index.mjs:1339:1"]}Jul 27, 10:43:15 AM: INIT_REPORT Init Duration: 685.08 msPhase: initStatus: errorError Type: Runtime.UnknownJul 27, 10:43:15 AM: ERROR Uncaught Exception {"errorType":"TypeError","errorMessage":"serverEntrypointModule[_start] is not a function","stack":["TypeError: serverEntrypointModule[_start] is not a function"," at file:///var/task/.netlify/build/entry.mjs:49:32"," at ModuleJob.run (node:internal/modules/esm/module_job:274:25)"," at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)"," at async _tryAwaitImport (file:///var/runtime/index.mjs:1030:16)"," at async _tryRequire (file:///var/runtime/index.mjs:1079:86)"," at async _loadUserApp (file:///var/runtime/index.mjs:1103:16)"," at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1148:21)"," at async start (file:///var/runtime/index.mjs:1332:23)"," at async file:///var/runtime/index.mjs:1339:1"]}Jul 27, 10:43:15 AM: INIT_REPORT Init Duration: 554.63 msPhase: invokeStatus: errorError Type: Runtime.UnknownJul 27, 10:43:15 AM: 8b8d19e3 Duration: 641.43 msMemory Usage: 124 MBJul 27, 10:43:23 AM: ERROR Uncaught Exception {"errorType":"TypeError","errorMessage":"serverEntrypointModule[_start] is not a function","stack":["TypeError: serverEntrypointModule[_start] is not a function"," at file:///var/task/.netlify/build/entry.mjs:49:32"," at ModuleJob.run (node:internal/modules/esm/module_job:274:25)"," at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)"," at async _tryAwaitImport (file:///var/runtime/index.mjs:1030:16)"," at async _tryRequire (file:///var/runtime/index.mjs:1079:86)"," at async _loadUserApp (file:///var/runtime/index.mjs:1103:16)"," at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1148:21)"," at async start (file:///var/runtime/index.mjs:1332:23)"," at async file:///var/runtime/index.mjs:1339:1"]}Jul 27, 10:43:23 AM: INIT_REPORT Init Duration: 551.16 msPhase: invokeStatus: errorError Type: Runtime.UnknownJul 27, 10:43:23 AM: 009aa355 Duration: 621.33 msMemory Usage: 129 MBJul 27, 10:43:23 AM: ERROR Uncaught Exception {"errorType":"TypeError","errorMessage":"serverEntrypointModule[_start] is not a function","stack":["TypeError: serverEntrypointModule[_start] is not a function"," at file:///var/task/.netlify/build/entry.mjs:49:32"," at ModuleJob.run (node:internal/modules/esm/module_job:274:25)"," at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)"," at async _tryAwaitImport (file:///var/runtime/index.mjs:1030:16)"," at async _tryRequire (file:///var/runtime/index.mjs:1079:86)"," at async _loadUserApp (file:///var/runtime/index.mjs:1103:16)"," at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1148:21)"," at async start (file:///var/runtime/index.mjs:1332:23)"," at async file:///var/runtime/index.mjs:1339:1"]}Jul 27, 10:43:23 AM: INIT_REPORT Init Duration: 531.17 msPhase: invokeStatus: errorError Type: Runtime.UnknownJul 27, 10:43:23 AM: 2a76afd8 Duration: 602.89 msMemory Usage: 127 MB
Here's my entry.mjs
import { renderers } from './renderers.mjs';
import { s as serverEntrypointModule } from './chunks/_@astrojs-ssr-adapter_CvSoi7hX.mjs';
import { manifest } from './manifest_DiZ6xYcn.mjs';
import { createExports } from '@astrojs/netlify/ssr-function.js';
const serverIslandMap = new Map();;
const _page0 = () => import('./pages/_image.astro.mjs');
const _page1 = () => import('./pages/2full2stack.astro.mjs');
const _page2 = () => import('./pages/about.astro.mjs');
const _page3 = () => import('./pages/archive.astro.mjs');
const _page4 = () => import('./pages/feed.astro.mjs');
const _page5 = () => import('./pages/guest-appearances.astro.mjs');
const _page6 = () => import('./pages/pomerium-live.astro.mjs');
const _page7 = () => import('./pages/tags/_tag_.astro.mjs');
const _page8 = () => import('./pages/tags.astro.mjs');
const _page9 = () => import('./pages/talks/_slug_.astro.mjs');
const _page10 = () => import('./pages/talks.astro.mjs');
const _page11 = () => import('./pages/index.astro.mjs');
const pageMap = new Map([
["node_modules/astro/dist/assets/endpoint/generic.js", _page0],
["src/pages/2full2stack.astro", _page1],
["src/pages/about.astro", _page2],
["src/pages/archive.astro", _page3],
["src/pages/feed.ts", _page4],
["src/pages/guest-appearances.astro", _page5],
["src/pages/pomerium-live.astro", _page6],
["src/pages/tags/[tag].astro", _page7],
["src/pages/tags/index.astro", _page8],
["src/pages/talks/[slug].astro", _page9],
["src/pages/talks.astro", _page10],
["src/pages/index.astro", _page11]
]);
const _manifest = Object.assign(manifest, {
pageMap,
serverIslandMap,
renderers,
actions: () => import('./_noop-actions.mjs'),
middleware: () => import('./_noop-middleware.mjs')
});
const _args = {
"middlewareSecret": "ed98ba84-c7d3-4a7d-a119-276849ac2ab9"
};
const _exports = createExports(_manifest, _args);
const __astrojsSsrVirtualEntry = _exports.default;
const _start = 'start';
{
serverEntrypointModule[_start](_manifest, _args);
}
export { __astrojsSsrVirtualEntry as default, pageMap };
astro.config.mjs
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import netlify from "@astrojs/netlify";
import react from "@astrojs/react";
// https://astro.build/config
export default defineConfig({
integrations: [
tailwind({
applyBaseStyles: false,
}),
react(),
],
output: "server",
adapter: netlify(),
});
package.json
{
"name": "nickyt.live",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro",
"prepare": "husky"
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/netlify": "^6.5.3",
"@astrojs/react": "^4.3.0",
"@astrojs/tailwind": "^6.0.2",
"astro": "^5.12.3",
"gsap": "^3.12.5",
"lint-staged": "^15.2.10",
"lucide-react": "^0.456.0",
"marked": "^12.0.1",
"rss-parser": "^3.13.0",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.9.5"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --cache --fix",
"*.{js,jsx,ts,tsx,css,md}": "prettier --write"
},
"devDependencies": {
"astro-eslint-parser": "^1.1.0",
"eslint": "^9.17.0",
"eslint-plugin-astro": "^1.3.1",
"husky": "^9.1.6",
"prettier": "^3.4.2",
"typescript-eslint": "^8.18.0"
}
}
What's the expected result?
I expect the deploy to Netlify to render without errors.
Link to Minimal Reproducible Example
Minimal repro
- Run
npm create astro@latest
- Accept all the defaults
- Go to the new dir,
cd my-astro-app
- Install the netlify-client globally if you haven’ already, https://docs.netlify.com/api-and-cli-guides/cli-guides/get-started-with-cli/#installation
- Run
npx astro add netlify
to add the Netlify adapter - Run
ntl init
to initialize the site for Netlify - Run
ntl build
- Look at the output of the entry point `cat .netlify/build/entry.mjs
- Notice the incorrectly generated build artiffact
import { s as serverEntrypointModule } from './chunks/_@astrojs-ssr-adapter_CvSoi7hX.mjs';
import { manifest } from './manifest_LjkP_eT0.mjs';
import { createExports } from '@astrojs/netlify/ssr-function.js';
const serverIslandMap = new Map();;
const pageMap = new Map([
]);
const _manifest = Object.assign(manifest, {
pageMap,
serverIslandMap,
renderers,
actions: () => import('./_noop-actions.mjs'),
middleware: () => import('./_noop-middleware.mjs')
});
const _args = {
"middlewareSecret": "cca10949-3131-49ff-a98a-edec8f294e4b"
};
const _exports = createExports(_manifest, _args);
const __astrojsSsrVirtualEntry = _exports.default;
const _start = 'start';
{
serverEntrypointModule[_start](_manifest, _args);
}
export { __astrojsSsrVirtualEntry as default, pageMap };
```
https://stackblitz.com/~/github.com/nickytonline/nickyt.live/tree/astro-5-upgrade
### Participation
- [x] I am willing to submit a pull request for this issue.