pilcrowOnPaper / oslo

A collection of auth-related utilities
https://oslo.js.org
MIT License
979 stars 31 forks source link

Oslo is not compatible with sveltekit 2.5.8/2.5.9 ? #75

Closed MahmoodKhalil57 closed 3 months ago

MahmoodKhalil57 commented 3 months ago

Edit: The issue has been resolved, I added a comment below, in my opinion this issue can be closed.

Hello Mr fox, Im not a pro so I cant really verify that this is the fault of Oslo in particular, so Ill give you all the information I can provide hoping you could help debug it. That being said, Im kindof confident it is Oslo though. Will make a sister ticket on sveltekit as they might have a clue.

Issue: I get a bug that bug that is a bit out of my skillset, so here it is (will add a comment of it so you can copy any text you want) image

When it happens: When I use sveltekit version ^2.5.8 and oslo version 1.2.0 together, Ive tried many other combinations until I landed on these two packages versions

How to reproduce: I have a template project which can be setup quickly to reproduce, pnpm is highly recommended as I only test with it. 1- Clone the project https://github.com/MahmoodKhalil57/svelte5-sveltekit-template

git clone https://github.com/MahmoodKhalil57/svelte5-sveltekit-template.git

2- copy .env.example into .env - no modifications needed to reproduce this bug

cp .env.example .env

3- init project (api needs some setup to work)

pnpm pre:dev

4- update the sveltekit package, skip this step if you want to see the project work

pnpm update @sveltejs/kit --latest && pnpm dev

5- run project and go to http://localhost:5173/login

pnpm dev

At this point if you have sveltekit ^2.5.8 and oslo 1.2.0 you should be able to get the error above, if you downgrade to sveltekit 2.5.7 the page should be able to load just fine

MahmoodKhalil57 commented 3 months ago
  VITE v5.2.11  ready in 1458 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
✘ [ERROR] No loader is configured for ".node" files: node_modules/.pnpm/@node-rs+argon2-linux-x64-gnu@1.7.0/node_modules/@node-rs/argon2-linux-x64-gnu/argon2.linux-x64-gnu.node

    node_modules/.pnpm/@node-rs+argon2@1.7.0/node_modules/@node-rs/argon2/index.js:222:38:
      222 │               nativeBinding = require('@node-rs/argon2-linux-x64-gnu')
          ╵                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] No loader is configured for ".node" files: node_modules/.pnpm/@node-rs+argon2-linux-x64-musl@1.7.0/node_modules/@node-rs/argon2-linux-x64-musl/argon2.linux-x64-musl.node

    node_modules/.pnpm/@node-rs+argon2@1.7.0/node_modules/@node-rs/argon2/index.js:209:38:
      209 │               nativeBinding = require('@node-rs/argon2-linux-x64-musl')
          ╵                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] No loader is configured for ".node" files: node_modules/.pnpm/@node-rs+bcrypt-linux-x64-gnu@1.9.0/node_modules/@node-rs/bcrypt-linux-x64-gnu/bcrypt.linux-x64-gnu.node

    node_modules/.pnpm/@node-rs+bcrypt@1.9.0/node_modules/@node-rs/bcrypt/binding.js:210:38:
      210 │               nativeBinding = require('@node-rs/bcrypt-linux-x64-gnu')
          ╵                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] No loader is configured for ".node" files: node_modules/.pnpm/@node-rs+bcrypt-linux-x64-musl@1.9.0/node_modules/@node-rs/bcrypt-linux-x64-musl/bcrypt.linux-x64-musl.node

    node_modules/.pnpm/@node-rs+bcrypt@1.9.0/node_modules/@node-rs/bcrypt/binding.js:199:38:
      199 │               nativeBinding = require('@node-rs/bcrypt-linux-x64-musl')
          ╵                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/mk/coding_projects/svelteTemplate_V2/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1651
  let error = new Error(text);
              ^

Error: Build failed with 4 errors:
node_modules/.pnpm/@node-rs+argon2@1.7.0/node_modules/@node-rs/argon2/index.js:209:38: ERROR: No loader is configured for ".node" files: node_modules/.pnpm/@node-rs+argon2-linux-x64-musl@1.7.0/node_modules/@node-rs/argon2-linux-x64-musl/argon2.linux-x64-musl.node
node_modules/.pnpm/@node-rs+argon2@1.7.0/node_modules/@node-rs/argon2/index.js:222:38: ERROR: No loader is configured for ".node" files: node_modules/.pnpm/@node-rs+argon2-linux-x64-gnu@1.7.0/node_modules/@node-rs/argon2-linux-x64-gnu/argon2.linux-x64-gnu.node
node_modules/.pnpm/@node-rs+bcrypt@1.9.0/node_modules/@node-rs/bcrypt/binding.js:199:38: ERROR: No loader is configured for ".node" files: node_modules/.pnpm/@node-rs+bcrypt-linux-x64-musl@1.9.0/node_modules/@node-rs/bcrypt-linux-x64-musl/bcrypt.linux-x64-musl.node
node_modules/.pnpm/@node-rs+bcrypt@1.9.0/node_modules/@node-rs/bcrypt/binding.js:210:38: ERROR: No loader is configured for ".node" files: node_modules/.pnpm/@node-rs+bcrypt-linux-x64-gnu@1.9.0/node_modules/@node-rs/bcrypt-linux-x64-gnu/bcrypt.linux-x64-gnu.node
    at failureErrorWithLog (/home/mk/coding_projects/svelteTemplate_V2/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1651:15)
    at /home/mk/coding_projects/svelteTemplate_V2/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1059:25
    at /home/mk/coding_projects/svelteTemplate_V2/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1527:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Node.js v21.7.3
 ELIFECYCLE  Command failed with exit code 1.
MahmoodKhalil57 commented 3 months ago

ope, sorry just saw https://github.com/pilcrowOnPaper/oslo/issues/74

This fixed my issue @pboling https://github.com/sveltejs/kit/issues/8140#issuecomment-2115391217

@pilcrowOnPaper if you still dont think anything can be done about this please close this issue, thank you for all your opensource work!!

pilcrowOnPaper commented 3 months ago

Updating the Vite config seems to be the only solution. Unless there's something we can do, I'm going to mark this as resolved

optimizeDeps: {
  exclude: ['@node-rs/argon2', '@node-rs/bcrypt']
},
MahmoodKhalil57 commented 3 months ago

Issue is fixed in sveltekit 2.5.10, need to update vite config. Thanks @pilcrowOnPaper and apologies for the hassel.