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

Conflicting public file and page route for /material causes server error #251

Open
ansarrafique opened this issue Jul 28, 2024 · 4 comments

Comments

@ansarrafique
Copy link

Bug

I encountered a Server Error while generating the page after clicking the "View the teaching materials" button on the landing page (home page). The error message indicates a conflict between a public file and a page file for the path /material.

Error Message

Error: A conflicting public file and page file was found for path /material https://nextjs.org/docs/messages/conflicting-public-file-page

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
DevServer.handleRequestImpl

Steps to Reproduce

  1. Clone the repository.
  2. Install the required dependencies.
  3. Start the local development server using yarn dev.
  4. Go to the home page.
  5. Click on the "View the teaching materials" button.

Expected Behavior

The application should correctly serve the teaching materials page without conflicts and without generating a server error.

System Information

  • OS: [e.g., Windows 11]
  • Browser: [e.g., Chrome, Brave]
  • Node Version: [e.g., 20.11.1]
  • NPM Version: [e.g., 10.8.2]
  • Corepack Version: [e.g., 0.29.3]
  • Yarn Version: [e.g., 3.3.0]

Additional Context

This error occurs specifically when navigating from the home page to the teaching materials page using the button provided. The conflict seems to be between a static file in the public directory and a dynamic route in the pages directory both named material.

@ansarrafique ansarrafique changed the title Conflicting Public File and Page Route for /material Causes Server Error Conflicting public file and page route for /material causes server error Jul 28, 2024
@alasdairwilson
Copy link
Collaborator

alasdairwilson commented Jul 28, 2024

Thanks for this bug report,

Do you have markdown material in the .material folder? IF not, run yarn pullmat to load the default material from the hpc-universe repo - if you wish to change this: this is configured in the yaml template in the config (https://blog.oxrse.uk/gutenberg/ has the details I think). If you have done this, and it still isn't working then let me know!

If this is the case, it is not ideal really that we get a crash here rather than a message on the /material page.

@ansarrafique
Copy link
Author

Yes, I do have the markdown material in the .material directory. I've managed to fix the problem by renaming the material to material-public in the public directory. This fixes the problem, but I am not sure if it's the right way?

@ansarrafique
Copy link
Author

@alasdairwilson Could you please confirm if this is the right approach and if it's safe to proceed?

@alasdairwilson
Copy link
Collaborator

I was able to recreate this by using windows, I kinda expected it to be a symbolic link issue because those do behave differently in windows and indeed it is.

Renaming would do nothing really because it is just a dead file in windows, I found that just deleting the symbolic link didn't seem to cause a problem with the build, the static pages are still built correctly however I can't remember the exact reason why the link is there.... so I would be reluctant to delete it incase it is part of some next wizardry for performance reasons.

You can however create an equivalent symbolic link using a powershell prompt and navigating to /public then:

New-Item -ItemType SymbolicLink -Path "material" -Target "../.material"

Which works identically, as far as my testing shows, to the existing one.

Also having seen the performance on native windows I would highly recommend using docker, there is a compose file for you to use to build the whole project or you can just build the dockerfile for just the node application, almost certainly will be more convenient for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants