Skip to content

Commit

Permalink
fix: better error message when using read with adapter-auto - closes
Browse files Browse the repository at this point in the history
 #11684 (#11689)

Co-authored-by: Rich Harris <[email protected]>
  • Loading branch information
Rich-Harris and Rich-Harris authored Jan 19, 2024
1 parent b3c8a8c commit 961ba2c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-spiders-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-auto': patch
---

fix: better error message when using `read`
7 changes: 7 additions & 0 deletions packages/adapter-auto/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,12 @@ export default () => ({
builder.log.warn(
'Could not detect a supported production environment. See https://kit.svelte.dev/docs/adapters to learn how to configure your app to run on the platform of your choosing'
);
},
supports: {
read: () => {
throw new Error(
"The read function imported from $app/server only works in certain environments. Since you're using @sveltejs/adapter-auto, SvelteKit cannot determine whether it will work when your app is deployed. Please replace it with an adapter tailored to your target environment."
);
}
}
});

0 comments on commit 961ba2c

Please sign in to comment.