Conspyre
WWasp-lang
•Created by Conspyre on 10/29/2024 in #🙋questions
signup email not working
Standing up a new app, on the development machine, changed the port to 4000 to avoid conflict with Stripe CLI.
Going through signup flow, nothing happens, no e-mail is sent, nothing is logged on the server giving a URL to complete authentication on dev.
38 replies
WWasp-lang
•Created by Conspyre on 9/20/2024 in #🙋questions
After deploying on Railway, database schema changes are not propagated
Wondering why my app isn't working, I check in the server logs to find there area lot of errors related to an undefined database field. This is because we added a database field after deploying to Railway.
Now we have steps for deploying the client, and deploying the server that both involve using the Railway CLI ("railway up"), however this step does not seem to address migrations.
I've tried changing the DATABASE_URL in my local .env.server to the URL provided by Railway and running "wasp db migrate-dev". This fails with:
❌ --- [Error] Can not connect to database: ---------------------------------------
The database needs to be running in order to execute this command. You can easily start a managed dev database with
wasp start db
.
How to deploy migrations to Railway?7 replies
WWasp-lang
•Created by Conspyre on 9/20/2024 in #🙋questions
Building wasp apps: Easy. Deploying wasp apps: ?!@#$
I've tried deploying the back-end with 1) Docker 2) Node 3) "wasp start" reverse proxied behind Apache
None of those work. All behave the same way. I can access my routes (e.g. /api/test) and wasp provided routes (e.g. /api/auth/me /api/auth/email/signup) are 404.
I've given up on deploying on my server (it's just not possible) and am trying Railway
There is a step which says "Open the Settings and go to the Variables tab: click Variable reference and select DATABASE_URL (it will populate it with the correct value)"
We are setting the DATABASE_URL
This step does not auto-populate as suggested. If we do not populate the field, it remains empty.
If I go, in railway, to the postgres block, I can find a DATABASE_URL to copy, so I populate the server's DATABASE_URL with it.
When my server starts, it crashes, claiming not to have a DATABASE_URL:
------
Error: Prisma schema validation - (get-config wasm)
Error code: P1012
error: Error validating datasource
db
: You must provide a nonempty URL. The environment variable DATABASE_URL
resolved to an empty string.
--> schema.prisma:4
|
3 | provider = "postgresql"
4 | url = env("DATABASE_URL")
------
Looking at the DATABASE_URL, it appears to be populated with the values we copied from the Postgres block in Railway (e.g. postgresql://postgres:[email protected]:5432/railway)
We are following the directions for Railway on https://wasp-lang.dev/docs/advanced/deployment/manually step by step, to the letter (have tried twice).
Please advise, over.43 replies
WWasp-lang
•Created by Conspyre on 9/19/2024 in #🙋questions
Deploying with Docker issues
I'm tryint to deploy the back-end with Docker on an Ubuntu box. I have the front end up via Apache, and the backend is reporting 404 on routes like /api/auth/me and /api/email/signup. I added a test route and I am able to hit it with curl via both localhost and the fully qualified DNS url - so that much is working.
I went in and hacked the .wasp/build/server/src/server.ts to print the list of routes, and, it's pretty much empty.
--------------------
ADDED THIS TO server.ts
function printRoutes(app: Express) {
console.log('Registered routes:');
app._router.stack.forEach((middleware) => {
if (middleware.route) {
// routes registered directly on the app
console.log(
${Object.keys(middleware.route.methods)} ${middleware.route.path}
);
} else if (middleware.name === 'router') {
// router middleware
middleware.handle.stack.forEach((handler) => {
if (handler.route) {
console.log(${Object.keys(handler.route.methods)} ${middleware.regexp} ${handler.route.path}
);
}
});
}
});
}
// Call this function just before server.listen()
printRoutes(app);
---------------------------
SERVER LOG AT STARTUP:
stripeMiddlewareFn is called
Starting pg-boss...
pg-boss started!
Registered routes:
get /^/?(?=/|$)/i / <------- AFAIK SHOULD BE ROUTES HERE
Server listening on port 3001
This suggests that the wasp build has failed to produce any. Trying this solution on dev, it does not appear that this code path is hit so I'm not able to see routes. Suggestions?17 replies
WWasp-lang
•Created by Conspyre on 9/16/2024 in #🙋questions
Issues with deploying to baremetal
The Wasp application is deployed, but all requests (including static assets) are being caught by the catch-all route, resulting in a "{"message":"Catch-all route"}" response.
- Apache is configured as a reverse proxy.
- Node.js server (Wasp backend) is running on port 5555.
- Static files are present in the correct build directory.
We've tried updating the Apache configuration to serve static files and proxy only API requests. I can verify that the Node.js server is responding correctly to API requests.
The application works correctly in development mode with wasp start.
Static assets are not being served properly in production; loading for instance http://<mysite>/index.html or http://<mysite>/login is being routed to the catch-all route, seemingly intercepting all requests.
35 replies
WWasp-lang
•Created by Conspyre on 9/8/2024 in #🙋questions
P1 bug in wasp causing insanity in developer. Please isolate and fix. :-)
I just spent a day tracking down a problem, which manifests itself in a very unusual way,.
Adding this line of code (to a server-side .js file):
import { subtractCredits } from 'wasp/server/operations'
This causes relative imports to stop working, and you can't fix the build by fixing them (obvious now, not so a few hours ago). The broken import is the only error emitted during the build, so the tools leave you in a hole. Git archaeology FTW.
-------
In main.wasp we have defined subtractCredits as follows:
action subtractCredits {
fn: import { subtractCredits } from "@src/payment/creditManagement.js",
entities: [User]
}
and in src/payment/creditManagement.ts we have a "export const subtractCredits = async (args, context) => { ... }.
Not 100% certain what's wrong here. This code is server side as stated above. We call it successfully from client. This is the first time I tried to call it from server, and not only does it not work, it silently murders the build. 😦 [EDIT: Just saw the mismatch between .js and .ts in the import/actual filetype, unfortunately that was not the cause of the problem as the imports still break after fixing...]
58 replies
WWasp-lang
•Created by Conspyre on 9/7/2024 in #🙋questions
"Hidden" schema error (?) causing cascading import failures
I had a feature branch working, with large numbers of code and schema changes. I switched branches, causing consternation in prisma & generated a migration and blew away the database in order to run. I did some other work in master, now I've switched back to the feature branch and made (another) migration for the same thing...
Now I am getting a seemingly endless series of errors on code which isn't changed by this branch, all of the form "import foo from '../somewhere/somthing".
It seems if I modify the import path in some way, like, say if it was "../server/foo" but we are already in the server directory, I can change it to "./foo" - which is technically the same directory, then we get past that error. Then another seemingly random import from another file (which used to work), is now failing, it seems the compilation stops on the first broken import & many are broken. I can sweep through many files which should not need to be changed, and seemingly never clear this. Wasp clean / wasp build does not change the outcome.
I believe this is related to a schema change, because had this same scenario ≈ two weeks ago and had to hand-merge-file-by-file until I -finally- got an error message related to schema which I fixed - and this problem went away. I forget what that issue was, but this is the same symptom.
What could be the issue @kapa.ai ?
8 replies
WWasp-lang
•Created by Conspyre on 9/6/2024 in #🙋questions
How to implement file upload middleware for large video files in a Wasp app?
...trying to implement a video upload feature in our Wasp app that can handle large files (>50MB) using chunked uploads. We need to configure middleware for file uploads, but we're encountering issues with setting up express-fileupload middleware in Wasp. What's the correct way to implement custom middleware for file uploads in a Wasp app, particularly for handling large files with multipart uploads to an S3-compatible storage (Wasabi)?
23 replies
WWasp-lang
•Created by Conspyre on 9/4/2024 in #🙋questions
server side imports of the form "./foo" used to work and now fail
Example:
import { taskCache } from './config';
This was working for many versions. I've created a new branch, added a bunch of new code which appears to have caused a new issue with this import style.
Now there are dozens of compile errors in the old code. ALL imports of this nature are failing. To make them compile again, I seem to have to do a pattern like:
import { taskCache } from "../server/config.js"
What could cause this behavior - and why do I need to make this change across a lot of imports which used to just work? I have not updated wasp.
9 replies
WWasp-lang
•Created by Conspyre on 9/3/2024 in #🙋questions
General Q: on every branch switch, wasp/prisma wants to make a new migration, is this the right way?
If I have a feature branch B and I switch back to branch A, it seems that prisma wants to create a migration to get the database back to the state which is A.
When I switch back to feature branch B, it seems that prisma wants to create a migration to get back to that state.
[repeats]
Is this the usual development paradigm? Creating new migrations each time we bounce to a different branch, or have I missed the proper workflow here?
6 replies
WWasp-lang
•Created by Conspyre on 9/2/2024 in #🙋questions
Dependency hell
Trying to install a package, and it wants to update react-router-dom. I've been in somewhere around the 5th ring of hell for the last hour, the path to Nirvana is entirely unclear as Wasp takes a massive 💩 when the version of react-router-dom != 5.3.3. What to do, @kapa.ai?
15 replies
WWasp-lang
•Created by Conspyre on 8/31/2024 in #🙋questions
One click deploy on baremetal?
Railway deploy is super simple, but VPS lack sufficient computrons for video tasks. Couple weeks ago, I tried deploying to baremetal/Ubuntu and was brickwalled on some $^%^% thing (details of which have long since popped off my stack). Is there any guidance to create a "one click" deploy script?
7 replies
WWasp-lang
•Created by Conspyre on 8/23/2024 in #🙋questions
Wasp-lang is the 💣
I don't have any technical questions for the bot or for the team today. It's been a month of learning wasp-lang. My app is functional, deployed to production, and being sent out to some people for testing. I know of no higher compliment to offer. Y'all fawking rock! 😎
8 replies
WWasp-lang
•Created by Conspyre on 8/22/2024 in #🙋questions
Is Railway still recommended? I note the instructions do not track the Railway site
Example: the docs state that we "generate domain" on the Railway site as the first step. Now, when you go to Railway, this is not an option, apparently it is done after the Deploy step? Unknown, hence, checking before spending significant time on it..
20 replies
WWasp-lang
•Created by Conspyre on 8/21/2024 in #🙋questions
Auth working on dev, not so on stage
App has been working, logging in/creating users works on dev, moving it to stage & now running into issues. I'm using the SaaS template & its default authentication. Now on both the /login and /signup routes, the action button is giving a 404. That's all coming from the <LoginForm> which is part of wasp.
Who is supposed to be handling these /auth/email/signup and /auth/email/login routes? Why do they work on the dev environment, but are not there in prod?
17 replies
WWasp-lang
•Created by Conspyre on 8/21/2024 in #🙋questions
Moving from dev (local) to staging server, access control issues abound
I am getting numerous errors loading the /signup page of the form:
[blocked] The page at https://mydomain.com/signup was not allowed to display insecure content from http://localhost:3001/auth/me
Then when I go to sign up, further errors of the form:
Not allowed to request resource
XMLHttpRequest cannot load http://loclhost:3001/auth/me due to access control checks
I cannot find any references in the app code to localhost or /auth/me so I assume this is coming from the wasp framework.
I've configured an extremely permissive cors middleware:
-----
import cors from 'cors';
export const corsMiddleware = cors({
origin: true, // Allow any origin
credentials: true,
});
-----
I note that there is only one endpoint in the main.wasp that specifies a middlewareConfigFn, and that is our Stripe webhook.
What could be the issue @kapa.ai
16 replies
WWasp-lang
•Created by Conspyre on 8/15/2024 in #🙋questions
Getting a 404 on our test API route
Trying adding an api route like so:
api inference {
fn: import { inferenceHandler } from "@src/server/api/inference.js",
middlewareConfigFn: import { inferenceMiddlewareFn } from "@src/server/api/inferenceMiddleware",
httpRoute: (POST, "/api/inference"),
auth: true
}
No errors are given in the output of "wasp start" however the route is 404 when we try to access it.
28 replies
WWasp-lang
•Created by Conspyre on 8/3/2024 in #🙋questions
Routing issues with signup/login
I'm using the provided boilerplate for signup/login, which use the <SignupForm> and <LoginForm> which appear to be provided by wasp. When user clicks the Login or Signup buttons, there is an error either /api/auth/username/login or /api/auth/username/signup are 404.
It is not clear what is happening, do we need to supply code for these routes?
9 replies