Open michaelcuneo opened 8 months ago
Hey! Thanks for this work. Modal changing their internals so frequently makes it hard to keep up to date.
Happy to accept a PR if you make one!
@ConProgramming I'm still trying to solve the bad URL, I think that's a problem with Vite 5.0 though, not the Modal side of this plugin, still reading up on the Vite 5.0 plugin changes. That'll be this evenings job. :)
I have been having the most unusual issues working on this.
I forked and cloned the entire repo. After modifying the bin.mjs
and sveltekit_modal
source code in src
... I run deno task dnt
which makes the npm folder
, then in example-app
, I rm -r node_modules
and pnpm i
to install everything again, based on the package.json
it pulls the sveltekit-modal
from the local ../npm
folder.
Most changes that I was making to sveltekit_modal didn't appear to be actually doing much, so I did a quick test and commented out the entire deploy command so that all it would do is a single deploy_log.stdout
.. but instead it actually deployed.
So I tested further by writing a new switch case called "testing": and ran it again, this time it broke past all of it and I got the Invalid command ${cmd}. Did you mean "deploy"?
... so I tested further by making sure that every single instance of bin.mjs
had identical commented out deployment code, and a testing case... STILL deployed.
At this point I am absolutely baffled, I have absolutely no idea where my computer is pulling the code from. I double checked and made sure that I didn't accidentally install sveltekit-modal globally, it's not global.
Well that was the most unusual problem I have ever experienced in my life, I troubleshooted that to the ends of the world and back... all of a sudden it worked fine. For about 12 hours, my computer was somehow getting the binary from who knows where. I'm almost there...
@ConProgramming hey, in this setup, where does the configuration tell modal what endpoint to hit when you make a request? Everything is working except if I hit the /api/summarize endpoint inside svelte it goes to the modal URL without /api/summarize on the end and returns 404... everything else is working fine.
Hi @ConProgramming @michaelcuneo - is the readme up to date or is there a new method needed to get this up and running?
Hi @ConProgramming @michaelcuneo - is the readme up to date or is there a new method needed to get this up and running?
I tried everything but I couldn't solve it completely, I ended up just running a monorepo and with my modal setup as one package and the SvelteKit app as another package.
Change 1: In the file
node_modules/sveltekit-modal/esm/src/vite/sveltekit_modal/src/app.py
Remove@stub.asgi_app()
Replace with@modal.asgi_app()
// and of course import modalChange 2: In the file
node_modules/sveltekit-modal/esm/src/vite/sveltekit_modal/src/serve.py
Removerun_serve_loop('sveltekit_modal.app', stdout=Logger(sys.stdout), show_progress=True)
Replace withserve_stub(stub_ref='sveltekit_modal.app', stub='sveltekit_modal.app', stdout=Logger(sys.stdout), show_progress=True)
Andimport from modal.serving import serve_stub
Change 3: In the file node_modules/sveltekit-modal/esm/src/vite/sveltekit_modal/src/deploy.py Remove
stub.deploy(stdout=Logger(sys.stdout), show_progress=True)
Replace withrunner.deploy_stub(stub, stdout=Logger(sys.stdout), show_progress=True)
// and of course import runner from modalChange 4: Remove
'secret': modal.Secret.from_name("my-openai-secret")
from yoursvelte_modal_config.py
and add it to the.run_function(secrets=[])
array. (All secrets are pushed in together into the one secrets array now)Change 5: Remove all
HUGGINGFACE_TOKEN
stuff... The pipeline won't use it.You will now get a successful deployment - However you won't get a successful formed URL it doesn't put the right URL into .env.production, you have to do all that manually, and even then I don't get any URL while running
npm run dev
However, if I
npm run build
, I do get a URL... but it doesn't actually ever trigger anything, always 404 not found or 200's... but error decoding response?I'll update when I solve.