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

Fix autogenerated append to original _headers file #851

Merged
merged 3 commits into from
Aug 7, 2024

Conversation

nickbabcock
Copy link
Contributor

Vercel hard links the public directory so when next-on-pages appends to file within the vercel output directory, it is also appending to the original public/_headers file too.

This commit fixes the problem by copying the contents to memory before unlinking the file and creating a new (non-linked) file.

I was able to test out this patch and saw it worked for when _headers exists and when it is absent.

Closes #848

Vercel hard links the public directory so when next-on-pages appends to
the vercel output directory, it is also appending to the original
`public/_headers` file too.

This commit fixes the problem by copying the contents to memory before
unlinking the file and creating a new (non-linked) file.

I was able to test out this patch and saw it worked for when `_headers`
exists and when it is absent.

Closes cloudflare#848
Copy link

changeset-bot bot commented Aug 5, 2024

🦋 Changeset detected

Latest commit: b7ee058

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@cloudflare/next-on-pages Patch
eslint-plugin-next-on-pages Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Aug 5, 2024

🧪 Prereleases are available for testing 🧪

@cloudflare/next-on-pages

You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/10282660127/npm-package-next-on-pages-851

@cloudflare/eslint-plugin-next-on-pages

You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/10282660127/npm-package-eslint-plugin-next-on-pages-851

Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! Thanks a bunch @nickbabcock 🙂 ❤️

I've just left a minor comment, also could you run npm run prettier:fix to format the code? 🙂🙏

@nickbabcock
Copy link
Contributor Author

Comments addressed, thank you 🙏

Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! thanks a lot for updating the comment and formatting the code 🙏

I've left two minor very last comments 😅 🙇

.changeset/breezy-walls-stare.md Outdated Show resolved Hide resolved
Co-authored-by: Dario Piotrowicz <[email protected]>
@dario-piotrowicz dario-piotrowicz merged commit 968171a into cloudflare:main Aug 7, 2024
8 checks passed
@dario-piotrowicz
Copy link
Member

Once again thanks a lot @nickbabcock 🫶

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

Successfully merging this pull request may close these issues.

[🐛 Bug]: next-on-pages repeatedly appends to _headers
2 participants