W
Wasp•2y ago
hometechdad

How do you set the org slug when deploying to Fly.io

How do you specify what organization you want to deploy to in Fly.io when using wasp deploy fly launch my-wasp-app mia ? I tried the fly commands of -o and --org but neither worked. If I do not add the org, it is failing with this error: Error: org slug must be specified when not running interactively. I added a 2nd organization to my fly.io account because when I first tried, I received an error stderr: "automatically selected personal organization: Jonathan\n" + "Error: Validation failed: Name may only contain numbers, lowercase letters and dashes\n" + "\n", I thought maybe the personal account name had an issue.. But looking back, the "\n" may be due to using WSL?? Not really sure...
9 Replies
shayne
shayne•2y ago
hey @hometechdad thanks for reaching out. unfortunately right now we don't have support for passing in the org to wasp deploy fly launch (or any other commands, but I think that is the only one that matters). i do plan to do some updates to fly deploy soon though, and have captured it here: https://github.com/wasp-lang/wasp/issues/1099 however, let's see if we can get you unstuck in the meantime... ok, i have a workaround. not ideal, but it should unblock you until we add support for this flag to launch 1) run which wasp to find your install dir 2) cat that script, eg. cat /home/shayne/.local/bin/wasp 3) cd into the waspc_datadir 4) cd into packages/deploy 5) find and edit the file dist/providers/fly/setup/setup.js update lines 37 and 49 by appending --org WHATEVER to the command launch command the background is our deploy script is really a TS project that we download when you install wasp, so what you are doing here is just patching that, and it will persist until you install a new version of wasp sorry about that, but hopefully this unblocks you for now 🤞 note i was only able to test it so far as adding --org FOO to mine and seeing an error about a missing org, but it should in theory work if you have one. after you get the toml files the rest of the steps should just use that
hometechdad
hometechdadOP•2y ago
Thanks @shayne ! This got me started. It turns out my original issue that lead me down this rabbit hole was not in fact that the org name was an issue, it was that my app name had capital letters in it... Your fix got me past the initial org slug error. However, when creating the DB it ran into the same error again. It looks like the org slug would need to be added to fly/createDb/createDB.js as well. Instead of continuing to edit deployment package files, I decided to go back to my original issue. 1. I deleted my 2nd org in Fly.io (back to just personal only). 2. I reverted the changes to fly/setup/setup.js 3. I deleted the toml files that had been created in my project folder 4. I re-ran wasp deploy fly launch <appname> mia with all lowercase for my app name. This allowed me to get 4 apps created in Fly.io. But the deploy command did end in an error (image attached). Testing things out now, I will report back. Thanks again for the help!
No description
shayne
shayne•2y ago
Ok that makes sense. Glad it’s progressing further this time. If you can share more of the output I can try to help with the new error.
hometechdad
hometechdadOP•2y ago
Thanks @shayne ! I started once again, by removing everything and decided to follow the manual deployment guide: https://wasp-lang.dev/docs/deploying I wanted to learn more about each step of the process. I am going the route of Fly.io for backend and Netlify for front end. Backend, setup worked great. I am able to see "Hello, world" from my https://<app-name>.fly.dev url. The first netlify command: npm install && REACT_APP_API_URL=<url_to_wasp_backend> npm run build spit out a bunch of errors like this one. > node -r dotenv/config ./scripts/validate-env.mjs ? Validating environment variables... src/auth/forms/Auth.tsx:474:23 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'ErrorMessage'. 474 setErrorMessage('The token is missing from the URL. Please check the link you received in your email.') These appear to be TypeSciprt errors, but I believe they are in the core wasp code (maybe the SaaS template? maybe this is somehow impacted by code I created??)? Let me know if I have gone far enough off topic for this question and I can pull this troubleshooting into the development channel?
Deploying | Wasp
Wasp is in beta, so keep in mind there might be some kinks / bugs, and possibly a bit bigger changes in the future.
hometechdad
hometechdadOP•2y ago
Ok, super new to TypeScript, so this may be totally wrong. But here is how I solved the issue... 1. Fixed any TypeScript errors in my local src files. Primarily class= instead of className= issues. 2. Updated .wasp\build\web-app\src\auth\forms\Auth.tsx line 473-476 to the following: if (!token) { let tmpErrorMsg = 'The token is missing from the URL. Please check the link you received in your email.' as unknown as ErrorMessage; setErrorMessage(tmpErrorMsg) return } 3. Updated .wasp\build\web-app\src\test\vitest\helpers.tsx line 13 to the following: export type { Route } from '../../types' This resolved all validation errors and allowed my front end to deploy on netlify. I am 🚀 to netlify and able to access my site. Testing functionality now 🙂 Downside is, that I need to update forms\Auth.tsx and helpers.tsx after each build. @Vinny (@Wasp) is this something that needs changed in the SaaS template? Or somewhere else? Or am I causing that issue somewhere?
Vinny (@Wasp)
Vinny (@Wasp)•2y ago
Did you change the <url-to-wasp-backend> when building the client ? It seems you didn’t add the actual url to the wasp backend when running that first command npm install && REACT_APP_API_URL=… Which wasp version are you on? Run wasp version. Another thing is to make sure you don’t have a trailing slash “/“ at the end of your backend url when running that command
IamIconLiving
IamIconLiving•2y ago
3. Updated .wasp\build\web-app\src\test\vitest\helpers.tsx line 13 to the following: export type { Route } from '../../types' -- I had the same issue, turned out to be outdated wasp binary https://discord.com/channels/686873244791210014/1098156757328597012/1098162907239432222
hometechdad
hometechdadOP•2y ago
Ahh, ok. I will try to update. Soccer tournaments all weekend, so I will try to report back later tonight. I had the URL without the "/" when running the npm install command. Thanks @IamIconLiving 🎄 that fixed the remaining 2 type errors!
MEE6
MEE6•2y ago
Wohooo @hometechdad, you just became a Waspeteer level 4!
Want results from more Discord servers?
Add your server