-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP ERROR 500 when deploying astrowind project #31
Comments
Just in case you don't want to dive into my GitHub repository: here's the /src/config.mjs file.
|
Hi @codewithdary The first thing that comes to mind is that for AstroWind you don't need the integration with vercel (@astrojs/vercel) since for now it is conceived to be static and has not yet been tested in SSR and that may be the problem. Is there any specific reason why you have installed the vercel integration? I will be testing your repo and in a moment I will give you more details. |
Hi again @codewithdary, We have reviewed in details. The thing is that AstroWind doesn't currently support SSR (or at least part of pages). Everything related to the Blog is developed using the standard for generating static pages through the code from slug.astro: // (...)
export async function getStaticPaths() {
if (BLOG?.disabled || BLOG?.post?.disabled) return [];
const posts = await fetchPosts();
return posts.map((post) => ({
params: {
slug: cleanSlug(post.slug),
blog: POST_BASE || undefined,
},
props: { post },
}));
}
const { post } = Astro.props;
// (...) In this case the same file has the responsibility to decide which pages will be generated and then it waits for a 'post' parameter obtained through Astro.props that brings the useful data to continue with the singular page. We are going to study the feasibility of providing a simple code that allows both SSR and static generation. As soon as we have something we will let you know. For now, you can follow two paths:
(...)
- import vercel from '@astrojs/vercel/serverless';
+ import vercel from '@astrojs/vercel/static';
(...)
- output: 'server',
+ output: 'static',
Example: - export async function getStaticPaths() {
- if (BLOG?.disabled || BLOG?.post?.disabled) return [];
- const posts = await fetchPosts();
- return posts.map((post) => ({
- params: {
- slug: cleanSlug(post.slug),
- blog: POST_BASE || undefined,
- },
- props: { post },
- }));
- }
- const { post } = Astro.props;
+ const { blog, slug } = Astro.params;
+
+ if (!isValidBlogBasepath(blog)) {
+ return new Response(null, {
+ status: 404,
+ statusText: 'Not found'
+ });
+ }
+
+ const post = await getPostBySlug(slug);
const meta = {
title: `${post.title} — ${SITE.name}`,
description: post.description,
canonical: post.canonical || getCanonical(getPermalink(post.slug, 'post')),
image: await findImage(post.image),
ogTitle: post.title,
ogType: "article"
}; I hope I can move forward with it. Anything else feel free to contact us. |
Your solution worked perfectly, thank you so much @widgeter :) |
Hi All!
I've been using your template and I'm really enjoying it so far. I've ran into a small issue and I hope that anyone can help me out :)
I've cloned your repository and deployed it through Vercel. When I enter the production URL, everything seems to work fine on the / endpoint. If I try to enter the /blog endpoint, I'll receive a 500 HTTP error.
Here are the steps that I took from cloning the project to deployment.
NPM installation
Accessed website through localhost where everything seem to work fine, even the /blog endpoint.
Deployment through Vercel
Added the following in my astro.config.mjs file
Added new files to Git
Installed Vercel CLI
Configuration through Vercel CLI
Deployment was successful. If I try to access the page through my production URL, the homepage works fine, but once I click on the /blog endpoint in the navigation, I’ll receive the following URL error:
Can someone please guide me through this issue? The link to my GitHub repository can be found right here.
The text was updated successfully, but these errors were encountered: