Skip to content

Commit

Permalink
refactor: easier to understand client env warning (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
nadilas committed Sep 3, 2022
1 parent 38e9af5 commit 52e9db7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/clean-snails-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-t3-app": patch
---

Extending the warning message for invalid client environment variables by including the reason
4 changes: 3 additions & 1 deletion cli/template/base/src/env/client.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ if (_clientEnv.success === false) {
*/
for (let key of Object.keys(_clientEnv.data)) {
if (!key.startsWith("NEXT_PUBLIC_")) {
console.warn("❌ Invalid public environment variable name:", key);
console.warn(
`❌ Invalid public environment variable name: ${key}. It must begin with 'NEXT_PUBLIC_'`,
);

throw new Error("Invalid public environment variable name");
}
Expand Down

1 comment on commit 52e9db7

@vercel
Copy link

@vercel vercel bot commented on 52e9db7 Sep 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

create-t3-app – ./

create-t3-app-t3-oss.vercel.app
create-t3-app-nu.vercel.app
create-t3-app-git-main-t3-oss.vercel.app

Please sign in to comment.