Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
Obteniendo el error "No hay usuario actual" en Amplify con Next.js

Traté de implementar una aplicación SSG en Amplify con Next.js siguiendo este tutorial pages/index.tsx funcionó bien. Pero pages/posts/[id].tsx no funciona y muestra el siguiente error.

 Server Error Error: No current user This error happened while generating the page. Any console logs will be displayed in the terminal window.

Y también la consola mostró este error.

 GET http://localhost:3000/posts/da53d1f3-775f-49c4-a311-d311f2e5623f 500 (Internal Server Error)

Mi código en pages/posts/[id].tsx es el siguiente. ¿Puedo tener su idea de cómo resolver este error?

 import { Amplify, API, withSSRContext } from "aws-amplify"; import Head from "next/head"; import { useRouter } from "next/router"; import awsExports from "../../aws-exports"; import { getPost, listPosts } from "../../graphql/queries"; Amplify.configure({ ...awsExports, ssr: true }); export async function getStaticPaths() { const SSR = withSSRContext(); const { data } = await SSR.API.graphql({ query: listPosts }); const paths = data.listPosts.items.map((post: any) => ({ params: { id: post.id }, })); return { fallback: true, paths, }; } export async function getStaticProps({ params }: { params: any }) { const SSR = withSSRContext(); const { data } = await SSR.API.graphql({ query: getPost, variables: { id: params.id, }, }); return { props: { post: data.getPost, }, }; } export default function Post({ post }: { post: any }) { const router = useRouter(); if (router.isFallback) { return ( <div> <h1>Loading&hellip;</h1> </div> ); } return ( <div> <h1>{post.title}</h1> <p>{post.content}</p> </div> ); }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!