admin管理员组文章数量:1122832
Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead.
'user server'
import { sql } from "@vercel/postgres";
const TodosPage = async () => {
const rows = await sql`
SELECT id, text, done FROM todos
ORDER BY id
`;
console.log(rows);
return (
<div className="p-4">
<h1 className="text-xl font-bold">To-Do List</h1>
<ul className="mt-4 space-y-2">
test
</ul>
</div>
);
};
export default TodosPage;
I cant display with nextjs on the server side what I see in the database. Apparently because of its async property
Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead.
'user server'
import { sql } from "@vercel/postgres";
const TodosPage = async () => {
const rows = await sql`
SELECT id, text, done FROM todos
ORDER BY id
`;
console.log(rows);
return (
<div className="p-4">
<h1 className="text-xl font-bold">To-Do List</h1>
<ul className="mt-4 space-y-2">
test
</ul>
</div>
);
};
export default TodosPage;
I cant display with nextjs on the server side what I see in the database. Apparently because of its async property
Share Improve this question asked Nov 22, 2024 at 16:01 Hugo Del-NegroHugo Del-Negro 1434 silver badges13 bronze badges2 Answers
Reset to default 0using a try cache got the error
VercelPostgresError: VercelPostgresError - 'missing_connection_string': You did not supply a 'connectionString' and no 'POSTGRES_URL' env var was found..
It seems postGres is not properly configured. Fixed it and apparently the issue is still there
Found the answer https://github.com/vercel/next.js/discussions/52336 is was using pages router instead of app router
本文标签: nextjsSSR Objects are not valid as a React child nextjsStack Overflow
版权声明:本文标题:next.js - SSR Objects are not valid as a React child nextjs - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736302489a1931553.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论