pevey / sveltekit-medusa-starter Goto Github PK
View Code? Open in Web Editor NEWStarter project to help you create your Medusa-powered ecommerce application
License: MIT License
Starter project to help you create your Medusa-powered ecommerce application
License: MIT License
After setting up my medusajs backend and configuring environment variables, I am able to implement products from the backend and add them to the cart. However, when I click "checkout" from the cart, and the checkout page loads, I get the message "your cart is empty" even after adding items to the cart. My terminal throws a TypeError:
{
id: 'u8IbOL8OTM6n96FJ5d9sX',
type: 'response',
timestamp: '2023-12-24T07:39:55.142Z',
url: 'http://localhost:9000/store/carts/cart_01HJDBBVCN2GBPS5ZW5XRWS6PE/payment-session',
status: 400,
statusText: 'Bad Request'
}
TypeError: Cannot read properties of undefined (reading 'total')
at POST (M:\storefront\src\routes\checkout\turnstile+server.ts:18:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Module.render_endpoint (M:\storefront\node_modules@sveltejs\kit\src\runtime\server\endpoint.js:43:18)
at async resolve (M:\storefront\node_modules@sveltejs\kit\src\runtime\server\respond.js:404:17)
at async Object.handle (M:\storefront\src\hooks.server.ts:10:21)
at async Module.respond (M:\storefront\node_modules@sveltejs\kit\src\runtime\server\respond.js:274:20)
at async file:///M:/storefront/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:510:22
I get these same results both before and after adding Stripe to my app.
Any Ideas? Thank you!
After setting up all my environment variables, everything is working correctly(turnstile, address autocompletion, stripe loading)
Only the payments fail although they show up in Stripe Dashboard as "incomplete"
This is the error in the console:
Something seems to be broken in this function but I can't tell what:
// confirm payment
const stripeResponse = await $stripeClient.confirmPayment({ elements: $stripeElements, redirect: 'if_required' })
if (stripeResponse.error) {
errorMessage = stripeResponse.error.message
processing = false
cancel()
} else {
return async ({ result }) => {
if (result.status === 200) {
success = true
order = result.data.order
}
}
}
Any ideas?
Thanks for the tutorial!
Following along with the video from SS and 'yarn dev' fails due to the alias config being commented:
sveltekit-medusa-starter/svelte.config.js
Lines 20 to 22 in e56489d
Error: [vite]: Rollup failed to resolve import "$src/app.postcss" from "/Users/ira/repos/sveltekit-medusa-starter/src/routes/+layout.svelte".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
Uncommenting the line fixes the bug
{
id: 'awZtmm4DT9WC7ikp9JKGB',
type: 'response',
timestamp: '2023-10-17T08:44:49.794Z',
url: 'http://localhost:9000/store/carts',
status: 400,
statusText: 'Bad Request'
}
TypeError: Cannot read properties of undefined (reading 'id')
at MedusaClient.addToCart (C:/Users/kenne/sveltekit/sveltekit-medusa-starter-main/node_modules/sveltekit-medusa-client/dist/index.js:338:36)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async add (C:/Users/kenne/sveltekit/sveltekit-medusa-starter-main/src/routes/cart/+page.server.ts:9:18)
at async Module.handle_action_json_request (C:/Users/kenne/sveltekit/sveltekit-medusa-starter-main/node_modules/@sveltejs/kit/src/runtime/server/page/actions.js:57:16)
at async resolve (C:/Users/kenne/sveltekit/sveltekit-medusa-starter-main/node_modules/@sveltejs/kit/src/runtime/server/respond.js:415:18)
at async Object.handle (C:/Users/kenne/sveltekit/sveltekit-medusa-starter-main/src/hooks.server.ts:7:20)
at async Module.respond (C:/Users/kenne/sveltekit/sveltekit-medusa-starter-main/node_modules/@sveltejs/kit/src/runtime/server/respond.js:282:20)
at async file:///C:/Users/kenne/sveltekit/sveltekit-medusa-starter-main/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:506:22
It only shows home to your site
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.