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

use of hooks sequence causes error in node adapter #3890

Closed
CaptainCodeman opened this issue Feb 13, 2022 · 2 comments
Closed

use of hooks sequence causes error in node adapter #3890

CaptainCodeman opened this issue Feb 13, 2022 · 2 comments

Comments

@CaptainCodeman
Copy link
Contributor

CaptainCodeman commented Feb 13, 2022

Describe the bug

Using the sequence function causes a runtime error using the node-adapter (possibly others too?) as it tries to import from '@sveltejs/kit/hooks' at runtime.

Error is:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@sveltejs/kit' imported from /app/build/server/app.js at new NodeError

Reproduction

Add hooks.ts to the default project, reference sequence. e.g.:

import { sequence } from '@sveltejs/kit/hooks'
import type { Handle } from "@sveltejs/kit/types/hooks"

const logging: Handle = async ({ event, resolve }) => {
  console.log(event.request.method, event.url.pathname, event.url.search)
  return resolve(event)
}

export const handle = sequence(logging)

Logs

No response

System Info

System:
    OS: macOS 12.2.1
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 174.89 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.3 - /usr/local/bin/node
    npm: 7.20.2 - /usr/local/bin/npm
  Browsers:
    Chrome: 98.0.4758.80
    Chrome Canary: 100.0.4886.0
    Edge: 98.0.1108.51
    Firefox: 96.0.3
    Safari: 15.3
    Safari Technology Preview: 15.4
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.17 
    @sveltejs/adapter-node: ^1.0.0-next.68 => 1.0.0-next.68 
    @sveltejs/kit: next => 1.0.0-next.267 
    svelte: ^3.44.0 => 3.46.4

Severity

Can work around by copying sequence function into project

Additional Information

Maybe related?

#3137
#1257

@Conduitry
Copy link
Member

Duplicate of #3709.

@CaptainCodeman
Copy link
Contributor Author

Sorry - how did that not come up when I searched?!?

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