Skip to content

[Bug]: appdir Next 13 SPA works, but when visit directly, it downloads a file instead #1847

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

Closed
1 of 2 tasks
antonybudianto opened this issue Dec 20, 2022 · 5 comments
Closed
1 of 2 tasks
Labels
type: bug code to address defects in shipped code

Comments

@antonybudianto
Copy link

antonybudianto commented Dec 20, 2022

Summary

Nextjs 13 with appdir, deployed with Netlify have issue where if the page is visited directly, it downloads a file instead...
This doesn't happen with local build+start

Sample: https://antonybudianto.com/blog/hello

Steps to reproduce

  1. Clone https://github.com/antonybudianto/next-antonybudianto/
  2. Deploy with Netlify
  3. Try visit page /blog/hello directly (not via links)
  4. It will download a file on browser instead of opening the page

A link to a reproduction repository

https://github.com/antonybudianto/next-antonybudianto/

Next Runtime version

4.29.3

More information about your build

  • I am building using the CLI
  • I am building using file-based configuration (netlify.toml)

What OS are you using?

Mac OS

Your netlify.toml file

`netlify.toml`
[[plugins]]
package = "@netlify/plugin-nextjs"

Your public/_redirects file

`_redirects`
# Paste content of your `_redirects` file here

Your next.config.js file

`next.config.js`
/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: false,
  swcMinify: true,
  experimental: {
    appDir: true,
  },
};

module.exports = nextConfig;

Builds logs (or link to your logs)

Build logs
# Paste logs here

Function logs

Function logs
# Paste logs here

.next JSON files

generated .next JSON files
# Paste file contents here. Please check there isn't any private info in them
# You can either build locally, or download the deploy from Netlify by clicking the arrow next to the deploy time.
@antonybudianto antonybudianto added the type: bug code to address defects in shipped code label Dec 20, 2022
@ascorbic
Copy link
Contributor

Hi. Next appDir isn't supported in the default version of the runtime yet. Can you try again after installing @netlify/plugin-nextjs@latest in your project?

@antonybudianto
Copy link
Author

Let me try with latest tag..

@antonybudianto
Copy link
Author

antonybudianto commented Dec 20, 2022

Ah it's good now with latest plugin version, however, the SPA navigation breaks now 😅

@ascorbic
Copy link
Contributor

Do you have a live example?

@ascorbic
Copy link
Contributor

ascorbic commented Dec 22, 2022

OK, I think I've diagnosed this, so I'm closing this in favour of #1844 which is the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants