Skip to content

fix: replace defineHandler with defineEventHandler#2102

Closed
Sigmabrogz wants to merge 3 commits into
solidjs:mainfrom
Sigmabrogz:fix/h3-define-event-handler
Closed

fix: replace defineHandler with defineEventHandler#2102
Sigmabrogz wants to merge 3 commits into
solidjs:mainfrom
Sigmabrogz:fix/h3-define-event-handler

Conversation

@Sigmabrogz

Copy link
Copy Markdown

Fixes #2101

h3 no longer exports defineHandler. It was replaced by defineEventHandler. This updates the import and usage in @solidjs/start so that the generated template is buildable.

Resolves an issue where npm init solid@latest generates an unbuildable template because h3 no longer exports defineHandler. defineEventHandler is the modern API.

Signed-off-by: Sigmabrogz <bnb1000bnb@gmail.com>
@netlify

netlify Bot commented Mar 13, 2026

Copy link
Copy Markdown

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit 6dc2af8
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/69d01987feb1e015f2f1a279
😎 Deploy Preview https://deploy-preview-2102--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot

changeset-bot Bot commented Mar 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6dc2af8

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

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

@pkg-pr-new

pkg-pr-new Bot commented Mar 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/start@2102
npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/vite-plugin-nitro-2@2102

commit: 6dc2af8

@Sigmabrogz

Copy link
Copy Markdown
Author

I've added the changeset as requested.

@Sigmabrogz

Copy link
Copy Markdown
Author

Hi maintainers, I've added the changeset as requested. The PR is ready for review. Would appreciate a review when you have time. Thanks!

options: HandlerOptions | ((context: PageEvent) => HandlerOptions | Promise<HandlerOptions>) = {},
) {
const handler = defineHandler({
const handler = defineEventHandler({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is there a reason for this change? Is the old one deprecated?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As the PR description says, H3 no longer exports defineHandler

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm confused, migration to v2 says to use defineHandler => https://h3.dev/migration#handler-utils

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The h3 docs state Migrate to defineHandler (you can also directly use a function!).. Ergo defineHandler is already the correct one.

@atilafassina atilafassina requested a review from brenelz April 3, 2026 19:54
@katywings

Copy link
Copy Markdown
Contributor

@Sigmabrogz As stated above, defineHandler is already the correct API. I think your npm install might have installed an old h3 version which resulted in your mentioned "defineHandler" is not exported by error 🤔. Closing this for now.

@katywings katywings closed this May 14, 2026
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?]: npm init solid@latest generates a template that is unbuildable

5 participants