Skip to content
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

/blog/tag/[tag]/ does not show on Vercel, but works on local prod. #229

Closed
AshGw opened this issue May 20, 2024 · 1 comment
Closed

/blog/tag/[tag]/ does not show on Vercel, but works on local prod. #229

AshGw opened this issue May 20, 2024 · 1 comment
Labels
bug Something isn't working must solved

Comments

@AshGw
Copy link
Owner

AshGw commented May 20, 2024

Bug description

Running Next 14.
When invoking process.cwd() like

export async function getBlogPosts(
  blogDirectory: string = BLOG_CONTENT_PATH
): Promise<Optional<PostData[]>> {
  console.log(
    'Invoked all blog posts from: ' + path.join(process.cwd(), blogDirectory)
  );
  return getMDXData(path.join(process.cwd(), blogDirectory));
}

I get this on vercel

Invoked all blog posts from: /var/task/public/blogs
Invoked all mdx data from: /var/task/public/blogs
Invoked all blog posts from: /var/task/public/blogs
Invoked all mdx data from: /var/task/public/blogs
Error reading MDX files: [Error: ENOENT: no such file or directory, scandir '/var/task/public/blogs'] {
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '/var/task/public/blogs'
}
Error reading MDX files: [Error: ENOENT: no such file or directory, scandir '/var/task/public/blogs'] {
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '/var/task/public/blogs'
}

Local production build

Invoked all blog posts from: /home/ashgw/work/ashgw.me/public/blogs
Invoked all mdx data from: /home/ashgw/work/ashgw.me/public/blogs
Invoked all blog posts from: /home/ashgw/work/ashgw.me/public/blogs
Invoked all mdx data from: /home/ashgw/work/ashgw.me/public/blogs

How to reproduce

No response

Expected behavior

No response

@AshGw AshGw added bug Something isn't working must labels May 20, 2024
@AshGw
Copy link
Owner Author

AshGw commented May 20, 2024

This solved it

/** @type {import('next').NextConfig} */

const nextConfig = {
  experimental: {
    outputFileTracingIncludes: {
      '/blog': ['./public/**/*'],
    },
  },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working must solved
Projects
None yet
Development

No branches or pull requests

1 participant