Skip to content

Blog fails when SSR is enabled #192

Closed
@jussi-photografi

Description

@jussi-photografi

Project doesn't work when SSR is enabled (npm run astro add react + set output: 'server' in astro.config.mjs). I'm new to Astro and modern frontend development, so I'm a bit lost here -- will I be able to run things like next-auth and React code with my project built on AstroWind?

10:17:33 PM [getStaticPaths] getStaticPaths() in src/pages/[...blog]/[category]/[...page].astro is ignored when "output: server" is set.
 error   Cannot read properties of undefined (reading 'currentPage')
  File:
    /home/jussi/Projects/poc/astrowind_vanilla/src/pages/[...blog]/[category]/[...page].astro:35:26
  Code:
    > 35 | const currentPage = page.currentPage ?? 1;
         |                          ^
      36 | const meta = {
      37 |   title: `Category'${category}' ${currentPage > 1 ? ` — Page ${currentPage}` : ''}`,
      38 |   description: SITE.description,
  Stacktrace:
TypeError: Cannot read properties of undefined (reading 'currentPage')
    at /home/jussi/Projects/poc/astrowind_vanilla/src/pages/[...blog]/[category]/[...page].astro:35:26
    at [...page] (/home/jussi/Projects/poc/astrowind_vanilla/node_modules/astro/dist/runtime/server/astro-component.js:19:12)
    at renderPage (file:///home/jussi/Projects/poc/astrowind_vanilla/node_modules/astro/dist/runtime/server/render/page.js:96:36)
    at renderPage (file:///home/jussi/Projects/poc/astrowind_vanilla/node_modules/astro/dist/core/render/core.js:109:24)
    at renderPage (file:///home/jussi/Projects/poc/astrowind_vanilla/node_modules/astro/dist/core/render/dev/index.js:133:16)
    at async handleRoute (file:///home/jussi/Projects/poc/astrowind_vanilla/node_modules/astro/dist/vite-plugin-astro-server/route.js:167:20)
    at async run (file:///home/jussi/Projects/poc/astrowind_vanilla/node_modules/astro/dist/vite-plugin-astro-server/request.js:47:14)
    at async runWithErrorHandling (file:///home/jussi/Projects/poc/astrowind_vanilla/node_modules/astro/dist/vite-plugin-astro-server/controller.js:65:5)
    at async handleRequest (file:///home/jussi/Projects/poc/astrowind_vanilla/node_modules/astro/dist/vite-plugin-astro-server/request.js:41:3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions