Cant find: src/shared/constants.ts file? Stripe connect.
There is no constants.ts file in my app? Do i have to create it?
"In stripe copy the Customer portal link. Paste it in your src/shared/constants.ts file"
41 Replies
hm let me check
GitHub
open-saas/app/src/shared at main Β· wasp-lang/open-saas
An open-source SaaS app template with superpowers. Contribute to wasp-lang/open-saas development by creating an account on GitHub.
it's there @Nurium
thx, so i created the file. Now i get error:
"[Server] src/shared/constants.ts(1,19): error TS2307: Cannot find module 'zod' or its corresponding type declarations.
[Server] [nodemon] app crashed - waiting for file changes before starting..."
~~~~~~~~
just did npm install zod, it works.
now error:
"[Server] using existing customer
[Server] POST /operations/stripe-payment 400 8352.576 ms - 665
[Server!] Error: Stripe Tax has not been activated on your account. Please visit www.stripe.com/docs/tax/set-up to get started.
[Server!] at StripeError.generate (file:///home/nurium_ubuntu/Projects/nurium_saas5/.wasp/out/server/node_modules/stripe/esm/Error.js:7:20)
[Server!] at res.toJSON.then.StripeAPIError.message (file:///home/nurium_ubuntu/Projects/nurium_saas5/.wasp/out/server/node_modules/stripe/esm/RequestSender.js:102:43)
[Server!] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
The Product doesnt seem to update with the price i set in Stripe
you shouldn't have to use npm or any package manager. wasp will take care of this for you
https://wasp-lang.dev/docs/project/dependencies
@Nurium I would suggest you pull the newest version of OpenSaaS
also, are you in India? I think certain countries need to activate Stripe Tax, as the error says
ok
im in sweden
ok. this error "Error: Stripe Tax has not been activated on your account. Please visit www.stripe.com/docs/tax/set-up to get started." has all the info you need
i thought it might be some bug, since im using test data
but maybe i have to do it anyway
yea I would try it and just stay in test mode
ok thx π
cool. no problem. let me know when you've got the newest version pulled
is there a way to update to latest version without installing it all over?
yes. use git to pull it from the origin repo
pull === fetch && merge
wont that overwrite all edits i made in css etc?
not if you've commited them
ok thx, bit new to git
ill try it
ok. what happens if you run
run
git remote -v
?cmd:
C:\Users\newadmin>git remote -v
fatal: not a git repository (or any of the parent directories): .git
Ubuntu wsl:
nurium_ubuntu@DESKTOP-NUD60OH:/mnt/c/WINDOWS/system32$ git remote -v
fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
you have to run that command in the open-saas directory
nurium_ubuntu@DESKTOP-NUD60OH:~/Projects/nurium_saas5$ git remote -v
fatal: not a git repository (or any of the parent directories): .git
~~~~
seems i havent installed git :P? thought i had it on vscode.
~~~~
Ill try to activate the tax i guess.
and update to latest version.
Wohooo @Nurium, you just became a Waspeteer level 4!
and install git lol.
if you didn't use git before how did you get the open-saas repo locally?
nurium_ubuntu@DESKTOP-NUD60OH:~/Projects/nurium_saas5$ git --version
git version 2.34.1
so i do have it
did you use
git clone https://github.com/wasp-lang/open-saas.git
to clone it to your local machine?yup
as in tutorial
following until stripe now
maybe your dir
H:~/Projects/nurium_saas
isn't the root of the project
make sure you're in the root folder of the project and try git remote -v
again\wsl.localhost\Ubuntu\home\nurium_ubuntu\Projects\nurium_saas5
nurium_ubuntu@DESKTOP-NUD60OH:~/Projects/nurium_saas5$ git --version
git version 2.34.1
nurium_ubuntu@DESKTOP-NUD60OH:~/Projects/nurium_saas5$ git remote -v
fatal: not a git repository (or any of the parent directories): .git
~~~~~~
cmd
C:\Users\newadmin>git --version
git version 2.43.0.windows.1
C:\Users\newadmin>git remote -v
fatal: not a git repository (or any of the parent directories): .git
C:\Users\newadmin>
here is a screen recording of me cloning a new open-saas project
when i
cd
into the root of the project, I can see that the origin is the correct urli didnt get the constants.ts file even when i git cloned the project
however now it works with: git remote -v
nurium_ubuntu@DESKTOP-NUD60OH:~/Projects/saas_tezt/open-saas$ git remote -v
origin htps://github.com/wasp-lang/open-saas.git (fetch)
origin htps://github.com/wasp-lang/open-saas.git (push)
~~
The first time i installed via: wasp new > project 3 Saas starter
~~
nurium_ubuntu@DESKTOP-NUD60OH:~/Projects/saas_tezt/open-saas$ git pull origin master
fatal: couldn't find remote ref master
Stripe Login | Sign in to the Stripe Dashboard
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Seems both products is using the second more expensive price i added, I made a product with 2 prices. 5eur and 9 eur, but it only uses 9 euro on both products. How do i set this?
Seems only one is in actions.ts code in server:
"
const session: Stripe.Checkout.Session = await stripe.checkout.sessions.create({
line_items: [
{
price: process.env.SUBSCRIPTION_PRICE_ID!,
quantity: 1,
},
],
mode: 'subscription',
success_url:
${DOMAIN}/checkout?success=true
,
cancel_url: ${DOMAIN}/checkout?canceled=true
,
automatic_tax: { enabled: true },
customer_update: {
address: 'auto',
},
customer: customer.id,
});"
should i add pro aswell? how?Hm. Thatβs not the most recent version of the code. Did you clone open-SaaS yet instead of using wasp new?
@martinsos I guess the issue Nurium is having here relates to a disparity between the current open SaaS code and the tagged version used in the templates. How can I update the tag so that the template gets the newest code?
so i kinda got it working on the old version i guess, except the two prices, only worked with one, not sure how i should edit to make both or more work.
I also did install the latest via git clone. However the constants.ts file didnt download then either, so again I created it and copied code from github. I get the app to run with this latest version.
However the stripe payment is not working at all on the newest version. I dont get any error message either in terminal. Just popup in app when tryna click Buy.
~~~~~~
seems actions.ts file is still like this in newest git clone version:
const session: Stripe.Checkout.Session = await stripe.checkout.sessions.create({
line_items: [
{
price: process.env.SUBSCRIPTION_PRICE_ID!,
quantity: 1,
},
],
mode: 'subscription',
success_url: ~~~~~~~~~~
Guess ill try just copy the new actions.ts code from github. But i did git clone it and it seems i still didnt get the latest code displayed on github..?
guess ill try to download the whole project as a zip file
im not sure what i did tbh.. When i create n write "wasp new" i have to choose 1-4 type of project basic todo saas embeddings. should i then remove the whole app and just put the new code in? Or how to create a empty wasp envoirment?
i deleted the app folder and put in the newest in a "wasp new". Seems to work.
error on wasp start (i did a wasp new, removed the app folder and copied in the zip downloaded newest from github):
"
...Installation going great - we'll get there soon!
[Client!] npm WARN ERESOLVE overriding peer dependency
[Client!] npm WARN While resolving: [email protected]
[Client!] npm WARN Found: typescript@undefined
[Client!] npm WARN node_modules/typescript
[Client!] npm WARN dev typescript@"^5.1.0" from the root project
[Client!] npm WARN
[Client!] npm WARN Could not resolve dependency:
[Client!] npm WARN peerOptional typescript@">= 4.4.x <= 5.2.x" from [email protected]
[Client!] npm WARN node_modules/msw
[Client!] npm WARN dev msw@"^1.1.0" from the root project
...The installation is taking a while, but we'll get there!
...You've been waiting so patiently, just wait a little longer (for the installation to finish)...
[Server!] npm ERR! code ECONNRESET
[Server!] npm ERR! network aborted
[Server!] npm ERR! network This is a problem related to network connectivity.
[Server!] npm ERR! network In most cases you are behind a proxy or have bad network settings.
[Server!] npm ERR! network
[Server!] npm ERR! network If you are behind a proxy, please make sure that the
[Server!] npm ERR! network 'proxy' config is set properly. See: 'npm help config'
[Server!]
[Server!] npm ERR! A complete log of this run can be found in:
[Server!] npm ERR! /home/nurium_ubuntu/.npm/_logs/2024-01-13T17_41_47_939Z-debug-0.log
β --- [Error] Your wasp project failed to compile: -------------------------------
- npm install failed: Setup failed! Server setup failed with exit code 1. Web app setup failed with exit code 1.
β --- [Error] Compilation of wasp project failed: --------------------------------
1 errors found"
${DOMAIN}/checkout?success=true
,
cancel_url: ${DOMAIN}/checkout?canceled=true
,
automatic_tax: { enabled: true },
customer_update: {
address: 'auto',
},
customer: customer.id,
});
That seems to be different then the new env.file (i also copied this structure from github since it wasnt like this when i downloaded, cant remember exactly how it looked).
HOBBY_SUBSCRIPTION_PRICE_ID=price_1OXkv5AHms7vVycMvx4PzB0N
PRO_SUBSCRIPTION_PRICE_ID=price_1OXkv5AHms7vVycM4IAAGRcT
Wohooo @Nurium, you just became a Waspeteer level 5!
hmm when npm has issues like this it is usually slow/unstable network. You can also try running
wasp clean
in app/ dir and then wasp start
, that will remove all the old node_modulesGood thinking but it shouldn't be that because wasp using those tags is not yet out!
We will have to think about this a bit once it gets out though.
ok i tried again seems to work now π