After deployment, can't access website
My page: https://svelte-cfpage.pages.dev/
My deployment ID: (I don't know how to get it)
My account ID: 80a06574599d689bb015dc39791e5f22
I don't get any errors. My main problem is that I succcesfully deployed (built) my website from a GitHub repo. After this I don't know what I should do to be able to access my website.
24 Replies
.
If you look at deployments for the Pages project in Cloudflare, does it list a deployment around the time you would expect? If so, does accessing that deployment specifically show what you expect? (URL should look something like https://a1b2c3.svelte-cfpage.pages.dev)
Yeah, it showed that, and the URL was also something like that, but for some reason when I tried to open it, it said that it doesn't exist
https://4facad8c.svelte-cfpage.pages.dev/
Oh wait..
For some reason it only uploaded 1 file
How can I fix that?
Do the build directories match in your project? (Configuration in the dashboard, I think) E.g. if Svelte puts its results into
build
, does your Pages project use build
?The directories match. I didn't push the built files to GitHub, I thought CF would build it. I guess that is the problem, right?
Shouldn’t be, but it would need to be configured to perform the build if it isn’t already. E.g. build command might need to be something like
npx svelte build
(I’m pulling that command out of nowhere, I don’t know Svelte specifically)On my local computer I can build it with
npm run build
.This is my build settings:
This is my GH repo:
https://github.com/sharkmu/svelte-cfpage
GitHub
GitHub - sharkmu/svelte-cfpage
Contribute to sharkmu/svelte-cfpage development by creating an account on GitHub.
Looks like there is some extra setup needed for Svelte like installing and using a different adapter:
https://developers.cloudflare.com/pages/framework-guides/deploy-a-svelte-site#sveltekit-cloudflare-configuration
Deploy a Svelte site · Cloudflare Pages docs
Svelte is an increasingly popular, open-source framework for building user interfaces and web applications. Unlike most frameworks, Svelte is …
Though looking at that again, I wonder if
/dist
should be /cfpage/dist
, i.e. if it’s building inside there rather than beside it.🤔
Interesting
In retrospect, the output directory will be relative to the current working directory, which is changed by root directory. Sorry about that.
When you run
npm run build
locally, are the files you want to upload created in dist
?Umn, no
Ah, that'll be why then. It looks like you're using SvelteKit based on
vite.config.js
, which probably means it's building into a .svelte-kit
directory or subdirectory.Oh, I forgot about that
Also probably means you'll need to complete the setup from my previous link, which also describes the build configuration to use.
Okay, thanks
I am currently not at home, but I'll try it out and get back to you
Big change
https://6a9f5069.svelte-cfpage.pages.dev/
Still not working..
If I change the adapter to the one you sent, would it work?
The comments in
svelte.config.js
for the adapter talk about adapter-auto only supporting some environments and to change it if necessary - I assume Cloudflare is one of the environments it doesn't support and so is necessary to change it.
It looks pretty straightforward, an npm install, a minor change to switch the adapter and changing the build configuration as shown a little further down. (Your root directory will need to remain as-is.)