abaga129 / sveltekit-adapter-iis

15 stars 5 forks source link

Cannot read properties of undefined (reading 'overrideNodeExePath') #22

Closed selfagency closed 2 months ago

selfagency commented 3 months ago

Using v1.2.5, getting this error whether building in Windows 11, Ubuntu 20, or MacOS 12.

error during build:
TypeError: Cannot read properties of undefined (reading 'overrideNodeExePath')
    at adapt (file:///C:/Users/dsieradski/AppData/Local/Temp/build/supplies_a6e56b4_08191133/node_modules/.pnpm/sveltekit-adapter-iis@1.2.5_@sveltejs+kit@2.5.22_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4._zdi7f4cf4t2cibhdtfjpomeu4a/node_modules/sveltekit-adapter-iis/index.js:110:26)
    at async adapt (file:///C:/Users/dsieradski/AppData/Local/Temp/build/supplies_a6e56b4_08191133/node_modules/.pnpm/@sveltejs+kit@2.5.22_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.18_vite@5.4.1_@types+node@_4xlelvq4bj7gg6gpbnhqcke6o4/node_modules/@sveltejs/kit/src/core/adapt/index.js:38:2)
    at async finalise (file:///C:/Users/dsieradski/AppData/Local/Temp/build/supplies_a6e56b4_08191133/node_modules/.pnpm/@sveltejs+kit@2.5.22_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.18_vite@5.4.1_@types+node@_4xlelvq4bj7gg6gpbnhqcke6o4/node_modules/@sveltejs/kit/src/exports/vite/index.js:890:7)
    at async Object.handler (file:///C:/Users/dsieradski/AppData/Local/Temp/build/supplies_a6e56b4_08191133/node_modules/.pnpm/@sveltejs+kit@2.5.22_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.18_vite@5.4.1_@types+node@_4xlelvq4bj7gg6gpbnhqcke6o4/node_modules/@sveltejs/kit/src/exports/vite/index.js:920:5)
    at async PluginDriver.hookParallel (file:///C:/Users/dsieradski/AppData/Local/Temp/build/supplies_a6e56b4_08191133/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/node-entry.js:19814:17)
    at async Object.close (file:///C:/Users/dsieradski/AppData/Local/Temp/build/supplies_a6e56b4_08191133/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/node-entry.js:20749:13)
    at async build (file:///C:/Users/dsieradski/AppData/Local/Temp/build/supplies_a6e56b4_08191133/node_modules/.pnpm/vite@5.4.1_@types+node@22.1.0_terser@5.31.3/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:65348:17)
    at async CAC.<anonymous> (file:///C:/Users/dsieradski/AppData/Local/Temp/build/supplies_a6e56b4_08191133/node_modules/.pnpm/vite@5.4.1_@types+node@22.1.0_terser@5.31.3/node_modules/vite/dist/node/cli.js:828:5)
 ELIFECYCLE  Command failed with exit code 1.
Write-Error: C:\Users\dsieradski\deploy.ps1:2
Line |
   2 |  ."\\wsl.localhost\Ubuntu-20.04\home\dsieradski\dev\supplies\deploymen …
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | ❌ An error occurred: pnpm build failed

Full Ubuntu build output:

vite v5.4.1 building SSR bundle for production...
✓ 1056 modules transformed.
✓ 1 webfont css downloaded. (1 ms, cache hit: 100.00%)
✓ 8 webfonts downloaded. (1 ms, cache hit: 100.00%)
vite v5.4.1 building for production...
✓ 1167 modules transformed.
✓ 1 webfont css downloaded. (6 ms, cache hit: 100.00%)
✓ 8 webfonts downloaded. (1 ms, cache hit: 100.00%)
.svelte-kit/output/client/_app/version.json 0.03 kB │ gzip:   0.05 kB
[blah blah blah]
.svelte-kit/output/client/_app/immutable/chunks/apexcharts.common.BJKICp18.js 532.23 kB │ gzip: 140.11 kB

(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 12.48s
.svelte-kit/output/server/_app/immutable/assets/cnyric_logo_white.Ck4JC5na.svg 5.63 kB
[blah blah blah]
.svelte-kit/output/server/chunks/index6.js 209.83 kB
✓ built in 25.03s

PWA v0.20.1
mode      generateSW
precache  420 entries (6099.69 KiB)
files generated
  .svelte-kit/output/server/sw.js
  .svelte-kit/output/server/workbox-e1498109.js
warnings
  One of the glob patterns doesn't match any files. Please remove or fix the following: {
  "globDirectory": ".svelte-kit/output",
  "globPattern": "prerendered/**/*.html",
  "globIgnores": [
    "server/*.*",
    "server/sw.js",
    "server/workbox-*.js"
  ]
}

Run npm run preview to preview your production build locally.

> Using sveltekit-adapter-iis
Adapting with @sveltejs/adapter-node
Circular dependency: node_modules/.pnpm/http-proxy-middleware@3.0.0/node_modules/http-proxy-middleware/dist/index.js -> node_modules/.pnpm/http-proxy-middleware@3.0.0/node_modules/http-proxy-middleware/dist/legacy/index.js -> node_modules/.pnpm/http-proxy-middleware@3.0.0/node_modules/http-proxy-middleware/dist/legacy/public.js -> node_modules/.pnpm/http-proxy-middleware@3.0.0/node_modules/http-proxy-middleware/dist/legacy/create-proxy-middleware.js -> node_modules/.pnpm/http-proxy-middleware@3.0.0/node_modules/http-proxy-middleware/dist/index.js
[blah blah blah]
Circular dependency: node_modules/.pnpm/fstream@1.0.12/node_modules/fstream/lib/writer.js -> node_modules/.pnpm/fstream@1.0.12/node_modules/fstream/lib/proxy-writer.js -> node_modules/.pnpm/fstream@1.0.12/node_modules/fstream/lib/writer.js
node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/util.js (201:4): Use of eval in "node_modules/.pnpm/bluebird@3.4.7/node_modules/bluebird/js/release/util.js" is strongly discouraged as it poses security risks and may cause issues with minification.
Finished adapting with @sveltejs/adapter-node
Adapting with sveltekit-adapter-iis
error during build:
TypeError: Cannot read properties of undefined (reading 'overrideNodeExePath')
    at adapt (file:///home/dsieradski/dev/supplies/node_modules/.pnpm/sveltekit-adapter-iis@1.2.5_@sveltejs+kit@2.5.22_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4._zdi7f4cf4t2cibhdtfjpomeu4a/node_modules/sveltekit-adapter-iis/index.js:110:26)
    at async adapt (file:///home/dsieradski/dev/supplies/node_modules/.pnpm/@sveltejs+kit@2.5.22_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.18_vite@5.4.1_@types+node@_4xlelvq4bj7gg6gpbnhqcke6o4/node_modules/@sveltejs/kit/src/core/adapt/index.js:38:2)
    at async finalise (file:///home/dsieradski/dev/supplies/node_modules/.pnpm/@sveltejs+kit@2.5.22_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.18_vite@5.4.1_@types+node@_4xlelvq4bj7gg6gpbnhqcke6o4/node_modules/@sveltejs/kit/src/exports/vite/index.js:890:7)
    at async Object.handler (file:///home/dsieradski/dev/supplies/node_modules/.pnpm/@sveltejs+kit@2.5.22_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.18_vite@5.4.1_@types+node@_4xlelvq4bj7gg6gpbnhqcke6o4/node_modules/@sveltejs/kit/src/exports/vite/index.js:920:5)
    at async PluginDriver.hookParallel (file:///home/dsieradski/dev/supplies/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/node-entry.js:19814:17)
    at async Object.close (file:///home/dsieradski/dev/supplies/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/node-entry.js:20749:13)
    at async build (file:///home/dsieradski/dev/supplies/node_modules/.pnpm/vite@5.4.1_@types+node@22.1.0_terser@5.31.3/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:65348:17)
    at async CAC.<anonymous> (file:///home/dsieradski/dev/supplies/node_modules/.pnpm/vite@5.4.1_@types+node@22.1.0_terser@5.31.3/node_modules/vite/dist/node/cli.js:828:5)

debug:

image

image

selfagency commented 3 months ago

Welp, I figured it out and it was really dumb. You must add an options object to the invocation in svelte.config.js even if you don't use it.

import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import postcssConfig from 'postcss-load-config';
import adapter from 'sveltekit-adapter-iis';

/** @type {import('@sveltejs/kit').Config} */
const config = {
  preprocess: [
    vitePreprocess({
      postcss: true,
      postcssConfig,
    }),
  ],
  kit: {
    adapter: adapter({}),  // <------------
    csp: {
      directives: {
        // 'script-src': ['self', 'unsafe-eval', 'https://unpkg.com'],
      },
    },
    csrf: {
      checkOrigin: false,
    },
  },
};

export default config;
ablesea commented 3 months ago

You'll most likely find yourself needing to add adapter options either way if you want things like form actions or logging to work.

selfagency commented 3 months ago

@ablesea i'm struggling with exposing my websocket server

ablesea commented 3 months ago

Not something that I have tried to do on IIS before nor with SvelteKit unfortunately

selfagency commented 3 months ago

@ablesea Now I'm trying to use http-proxy-middleware and it's running great in Vite but not at all once built with the adapter, returning blank pages instead of passing through connections to my API server. I would very much appreciate your help with that.

hooks.server.ts

const apiProxy = createProxyMiddleware({
  target: PUBLIC_API_ENDPOINT,
  changeOrigin: true,
});