mm
mm
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
No description
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
When I have the time I will try this out in a fresh opensaas setup. I kinda re-organized the directories for this project maybe that's causing this? though I'm not sure if it's supposed to be an issue.
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
No description
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
I'll check later after deployment. or can I run wasp start while deploying??
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
these are the files that make uses the utils
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
No description
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
let me double check
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
nope
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
I only used it for jobs in this case
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
I'm not using it directly inside a client code
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
I'm using it inside a job
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
what I did to make it work is to simply pass the PrismaClient
export const logger = async (prisma: PrismaClient, { message, level = 'info', data = {} }: LogParams) => {
await prisma.logs.create({
data: {
message: message,
level: level,
data: data,
},
});
}
export const logger = async (prisma: PrismaClient, { message, level = 'info', data = {} }: LogParams) => {
await prisma.logs.create({
data: {
message: message,
level: level,
data: data,
},
});
}
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
So there is a probability that this utility is being considered as client code? what do you think that's why I can't put back-end specific code in it?
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
you mean if it's an issue with config.ts high probability that it's being used on client side?
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
Yes it says config.ts
27 replies
WWasp-lang
Created by mm on 8/8/2024 in #đŸ™‹questions
Uncaught Error when using prisma inside `app/src/server/utils.ts`
No I'm only using the logger on the server side
27 replies
WWasp-lang
Created by mm on 7/25/2024 in #đŸ™‹questions
How: Dynamic Email Sender configuration
hi @martinsos I created a dev article for this one https://dev.to/medardm/using-mailhog-in-wasp-4n2p This is actually my first lol, apologies if it's not that good, let me know if I need to change anything
14 replies
WWasp-lang
Created by Matteo Kinkela (GreatValorKing) on 5/2/2023 in #đŸ™‹questions
Writing raw queries
OMG I missed this one in the docs. thank you so much!
16 replies
WWasp-lang
Created by mm on 7/25/2024 in #đŸ™‹questions
How: Dynamic Email Sender configuration
Well this is really not an important feature, having dynamic sender config. it's pretty dynamic using SMTP
14 replies
WWasp-lang
Created by Matteo Kinkela (GreatValorKing) on 5/2/2023 in #đŸ™‹questions
Writing raw queries
I came accross a scenario where I need to write raw queries, is there a way for this now? Scenario,
Table A
|____Table B
|____Table C
Table A
|____Table B
|____Table C
Basically table B and Table C have different purpose but share the same ids
Table B:
- tableAId
- otherId

Table C
- tableAId
- otherId
Table B:
- tableAId
- otherId

Table C
- tableAId
- otherId
In short they are closely related, while querying Table B, I needed to get the matching data from Table C as well and merge them however they are not directly related (no FKs) What I need to do - Perform an inner join with Table B and C to merge the data However Prisma does not support this feature yet, you can only join those that are directly related (thru FKs) So the only solution is to perform a raw query
SELECT tb.*, tc.*
FROM tableB tb
INNER JOIN tableC tc
ON tb.tableAId = tc.tableBId
AND tb.otherId = tc.otherId
SELECT tb.*, tc.*
FROM tableB tb
INNER JOIN tableC tc
ON tb.tableAId = tc.tableBId
AND tb.otherId = tc.otherId
A workaround using prisma is querying both tables and mapping but that is not very efficient I think
16 replies