You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now use use netlify serve in the SvelteKit integration tests. We use it without any flags. It'd be nice if we could use @netlify/dev instead as it would let us drop hundreds of dependencies from netlify-cli. While I could theoretically wrap @netlify/dev in a CLI myself, it would introduce extra work for me and it'd be nicer if I could just call it directly
Server Error
TypeError: Cannot read properties of undefined (reading 'status')
at Array. (file:///home/bmccann/src/kit/node_modules/.pnpm/[email protected]/node_modules/srvx/dist/log.mjs:14:51)
It seems to be trying to log an error, but can't because res is undefined:
I set the projectRoot to build, which contains _app, _headers, and _redirects and provided --port=8888 to srvx. I pushed a branch here in case you're able to take a look and see anything I might have done wrong: sveltejs/kit#14686
I did some digging and and the reason this doesn't work is because there are fundamental differences between netlify serve and netlify dev. I'll have to find out the exact differences but my hunch is that the @netlify/dev package won't solve our issue.
I'm thinking we probably need to overhaul our Netlify adapter output so that it matches the newer standards from Netlify. Otherwise, the easy workaround for now is to just explicitly specify these in the netlify config.
Activity
serhalp commentedon Oct 10, 2025
Hey @benmccann I was taking a look at this again and this seems to work:
Install
@netlify/devand runnpx srvx. Seems to work with my limited testing!We're not quite sure this makes sense to expose and publish 🤔.
If this works for you, let me know and we'll document it in the README or something!
benmccann commentedon Oct 10, 2025
Thank you so much for looking at this!
Unfortunately it doesn't work for me. I get:
It seems to be trying to log an error, but can't because
resis undefined:I set the
projectRoottobuild, which contains_app,_headers, and_redirectsand provided--port=8888tosrvx. I pushed a branch here in case you're able to take a look and see anything I might have done wrong: sveltejs/kit#14686serhalp commentedon Oct 11, 2025
My bad — classic mistake: I made a small change without testing right before sharing the code snippet here and it introduced that issue 🤦🏼.
Change the last line to:
benmccann commentedon Oct 11, 2025
Thanks! It's a step in the right direction. Now the question is why is it getting a 404? On
mainif I visit http://localhost:8888/read I get a response stating "Hello! This file is read byreadfrom$app/server." whereas I get a 404 on the branch from sveltejs/kit#14686 using@netlify/devteemingc commentedon Jan 15, 2026
I did some digging and and the reason this doesn't work is because there are fundamental differences betweennetlify serveandnetlify dev. I'll have to find out the exact differences but my hunch is that the@netlify/devpackage won't solve our issue.netlify serve: https://github.com/netlify/cli/blob/main/src/commands/serve/serve.tsnetlify dev: https://github.com/netlify/cli/blob/main/src/commands/dev/dev.tsEDIT: looking at the source code more closely, they seem almost the same? I'll keep digging to figure out why
serveworks butdevdoesn'tteemingc commentedon Jan 15, 2026
I've managed to get it working! One of the reasons it wasn't before was because the dev server wasn't picking up our
manifest.jsonfiles in the build output. It was also looking in the wrong directory for the functions (we output to.netlify/edge-functionsbut it looks fornetlify/edge-functionsby default).See https://vscode.dev/github/netlify/primitives/blob/main/packages/dev/src/main.ts#L557-L559.
I'm thinking we probably need to overhaul our Netlify adapter output so that it matches the newer standards from Netlify. Otherwise, the easy workaround for now is to just explicitly specify these in the netlify config.
EDIT: created sveltejs/kit#15169