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

Add CLI option to ignore invalid functions #867

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nickbabcock
Copy link
Contributor

The presence of invalid functions shouldn't force a build failure as a deployment can still be valid (and even correct as outlined in #845) with invalid functions.

This commit adds a --force cli option (discussion welcomed!) that allows users to opt to ignore invalid functions (and skip more checks in the future?).

Closes #845

The presence of invalid functions shouldn't force a build failure as a
deployment can still be valid (and even correct as outlined in cloudflare#845)
with invalid functions.

This commit adds a `--force` cli option (bike-shedding welcomed) that
allows users to opt to ignore invalid functions (and skip more checks in
the future?).

Closes cloudflare#845
Copy link

changeset-bot bot commented Aug 27, 2024

🦋 Changeset detected

Latest commit: 9f9e501

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 Minor
eslint-plugin-next-on-pages Minor

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 27, 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/10579290331/npm-package-next-on-pages-867

@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/10579290331/npm-package-eslint-plugin-next-on-pages-867

if (collectedFunctions.invalidFunctions.size > 0) {
if (
collectedFunctions.invalidFunctions.size > 0 &&
!opts.ignoreInvalidFunctions
Copy link
Contributor

Choose a reason for hiding this comment

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

my concern with this approach is that people may find and use --force because they get this error, without actually accounting for the routes properly... In your case, you want to host these routes elsewhere, but I imagine there'll be people who don't realise they need to actually specify these routes should execute somewhere else, and expect it to just work by forcing a build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same. I don't enjoy the thought of forcing a build.

I worry that the alternative of trying to better evaluate the next.config to determine if the function is actually invalid may be fraught with difficulty (I've not looked too closely, so I'll defer to your judgement). Is this what you had in mind?

Would printing a warning instead of exiting be sufficient? So the errors aren't swept under the rug.

From a connotation perspective, I find force to be ok, but I'm happy to rename the argument as well

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.

[⚡ Feature]: Allow split deployments with latent nodejs runtime functions
2 participants