wardbox
wardbox
WWasp-lang
Created by wardbox on 11/2/2024 in #đŸ™‹questions
CORS is blocking www
www.dylankappler.com/:1 Access to XMLHttpRequest at 'https://devsite-server.fly.dev/operations/get-version' from origin 'https://www.dylankappler.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. when accessing my site at www i get this cors error.
16 replies
WWasp-lang
Created by wardbox on 10/28/2024 in #đŸ™‹questions
wasp db studio connecting to prod db shows now data
I've got my connection string in my env vars, and I can confirm that commenting it out connects me to my local db which does show data. I can also confirm I see data in my app deployed to fly.io.
24 replies
WWasp-lang
Created by wardbox on 10/26/2024 in #đŸ™‹questions
wasp deploy fly deploy failure
Wasp version: 0.15.0 Platform: MacOS I am using the wasp ts. Locally everything builds fine. I've tried doing wasp clean and wasp ts-setup again with no luck.
_stderr: '==> Verifying app config\n' +
'--> Verified app config\n' +
'==> Building image\n' +
'Waiting for depot builder...\n' +
'\n' +
'==> Building image with Depot\n' +
'--> build: (​)\n' +
'#1 [internal] load build definition from Dockerfile\n' +
'#1 DONE 0.0s\n' +
'\n' +
'#1 [internal] load build definition from Dockerfile\n' +
'#1 transferring dockerfile: 3.18kB 0.0s done\n' +
'#1 DONE 0.0s\n' +
'\n' +
'#2 [internal] load metadata for docker.io/library/node:18.18.0-alpine3.17\n' +
'#2 CANCELED\n' +
'==> Building image\n' +
'Waiting for depot builder...\n' +
'\n' +
'==> Building image with Depot\n' +
'--> build: (​)\n' +
'#1 [internal] load build definition from Dockerfile\n' +
'#1 transferring dockerfile: 3.18kB 0.0s done\n' +
'#1 DONE 0.0s\n' +
'\n' +
'#2 [internal] load metadata for docker.io/library/node:18.18.0-alpine3.17\n' +
'#2 DONE 0.7s\n' +
'\n' +
'#3 [internal] load .dockerignore\n' +
'#3 transferring context: 101B 0.0s done\n' +
'#3 DONE 0.0s\n' +
'\n' +
'#4 [node 1/1] FROM docker.io/library/node:18.18.0-alpine3.17@sha256:8cdc5ff72de424adca7217dfc9a6c4ab3f244673789243d0559a6204e0439a24\n' +
'#4 resolve docker.io/library/node:18.18.0-alpine3.17@sha256:8cdc5ff72de424adca7217dfc9a6c4ab3f244673789243d0559a6204e0439a24 done\n' +
'#4 DONE 0.0s\n' +
'\n' +
'#5 [base 1/1] RUN apk --no-cache -U upgrade # To ensure any potential security patches are applied.\n' +
'#5 CACHED\n' +
'\n' +
'#6 [server-production 1/10] RUN apk add --no-cache python3\n' +
'#6 CACHED\n' +
'\n' +
'#7 [server-production 2/10] WORKDIR /app\n' +
'#7 CACHED\n' +
'\n' +
'#8 [internal] load build context\n' +
'#8 ...\n' +
'\n' +
'#9 [server-builder 3/11] COPY src ./src\n' +
'#9 CACHED\n' +
'\n' +
'#10 [server-builder 5/11] COPY package-lock.json .\n' +
'#10 CACHED\n' +
'\n' +
'#11 [server-builder 6/11] COPY server .wasp/build/server\n' +
'#11 CACHED\n' +
'\n' +
'#12 [server-builder 1/11] RUN apk add --no-cache python3 build-base libtool autoconf automake\n' +
'#12 CACHED\n' +
'\n' +
'#13 [server-builder 2/11] WORKDIR /app\n' +
'#13 CACHED\n' +
'\n' +
'#14 [server-builder 4/11] COPY package.json .\n' +
'#14 CACHED\n' +
'\n' +
'#15 [server-builder 7/11] COPY sdk .wasp/out/sdk\n' +
'#15 CACHED\n' +
'\n' +
'#8 [internal] load build context\n' +
'#8 transferring context: 7.77MB 0.9s done\n' +
'#8 ...\n' +
'\n' +
'#16 [server-builder 8/11] RUN npm install && cd .wasp/build/server && npm install\n' +
"#16 1.622 npm ERR! Cannot read properties of undefined (reading 'extraneous')\n" +
'#16 1.624 \n' +
'#16 1.624 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-10-26T18_18_20_185Z-debug-0.log\n' +
'#16 ERROR: process "/bin/sh -c npm install && cd .wasp/build/server && npm install" did not complete successfully: exit code: 1\n' +
'------\n' +
' > [server-builder 8/11] RUN npm install && cd .wasp/build/server && npm install:\n' +
"1.622 npm ERR! Cannot read properties of undefined (reading 'extraneous')\n" +
'1.624 \n' +
'1.624 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-10-26T18_18_20_185Z-debug-0.log\n' +
'------\n' +
'Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c npm install && cd .wasp/build/server && npm install" did not complete successfully: exit code: 1\n',
_stderr: '==> Verifying app config\n' +
'--> Verified app config\n' +
'==> Building image\n' +
'Waiting for depot builder...\n' +
'\n' +
'==> Building image with Depot\n' +
'--> build: (​)\n' +
'#1 [internal] load build definition from Dockerfile\n' +
'#1 DONE 0.0s\n' +
'\n' +
'#1 [internal] load build definition from Dockerfile\n' +
'#1 transferring dockerfile: 3.18kB 0.0s done\n' +
'#1 DONE 0.0s\n' +
'\n' +
'#2 [internal] load metadata for docker.io/library/node:18.18.0-alpine3.17\n' +
'#2 CANCELED\n' +
'==> Building image\n' +
'Waiting for depot builder...\n' +
'\n' +
'==> Building image with Depot\n' +
'--> build: (​)\n' +
'#1 [internal] load build definition from Dockerfile\n' +
'#1 transferring dockerfile: 3.18kB 0.0s done\n' +
'#1 DONE 0.0s\n' +
'\n' +
'#2 [internal] load metadata for docker.io/library/node:18.18.0-alpine3.17\n' +
'#2 DONE 0.7s\n' +
'\n' +
'#3 [internal] load .dockerignore\n' +
'#3 transferring context: 101B 0.0s done\n' +
'#3 DONE 0.0s\n' +
'\n' +
'#4 [node 1/1] FROM docker.io/library/node:18.18.0-alpine3.17@sha256:8cdc5ff72de424adca7217dfc9a6c4ab3f244673789243d0559a6204e0439a24\n' +
'#4 resolve docker.io/library/node:18.18.0-alpine3.17@sha256:8cdc5ff72de424adca7217dfc9a6c4ab3f244673789243d0559a6204e0439a24 done\n' +
'#4 DONE 0.0s\n' +
'\n' +
'#5 [base 1/1] RUN apk --no-cache -U upgrade # To ensure any potential security patches are applied.\n' +
'#5 CACHED\n' +
'\n' +
'#6 [server-production 1/10] RUN apk add --no-cache python3\n' +
'#6 CACHED\n' +
'\n' +
'#7 [server-production 2/10] WORKDIR /app\n' +
'#7 CACHED\n' +
'\n' +
'#8 [internal] load build context\n' +
'#8 ...\n' +
'\n' +
'#9 [server-builder 3/11] COPY src ./src\n' +
'#9 CACHED\n' +
'\n' +
'#10 [server-builder 5/11] COPY package-lock.json .\n' +
'#10 CACHED\n' +
'\n' +
'#11 [server-builder 6/11] COPY server .wasp/build/server\n' +
'#11 CACHED\n' +
'\n' +
'#12 [server-builder 1/11] RUN apk add --no-cache python3 build-base libtool autoconf automake\n' +
'#12 CACHED\n' +
'\n' +
'#13 [server-builder 2/11] WORKDIR /app\n' +
'#13 CACHED\n' +
'\n' +
'#14 [server-builder 4/11] COPY package.json .\n' +
'#14 CACHED\n' +
'\n' +
'#15 [server-builder 7/11] COPY sdk .wasp/out/sdk\n' +
'#15 CACHED\n' +
'\n' +
'#8 [internal] load build context\n' +
'#8 transferring context: 7.77MB 0.9s done\n' +
'#8 ...\n' +
'\n' +
'#16 [server-builder 8/11] RUN npm install && cd .wasp/build/server && npm install\n' +
"#16 1.622 npm ERR! Cannot read properties of undefined (reading 'extraneous')\n" +
'#16 1.624 \n' +
'#16 1.624 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-10-26T18_18_20_185Z-debug-0.log\n' +
'#16 ERROR: process "/bin/sh -c npm install && cd .wasp/build/server && npm install" did not complete successfully: exit code: 1\n' +
'------\n' +
' > [server-builder 8/11] RUN npm install && cd .wasp/build/server && npm install:\n' +
"1.622 npm ERR! Cannot read properties of undefined (reading 'extraneous')\n" +
'1.624 \n' +
'1.624 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-10-26T18_18_20_185Z-debug-0.log\n' +
'------\n' +
'Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c npm install && cd .wasp/build/server && npm install" did not complete successfully: exit code: 1\n',
61 replies
WWasp-lang
Created by wardbox on 10/17/2024 in #đŸ™‹questions
Migrating from v0.14 to v0.15, entities not found
Seeing these errors after following migration steps to v0.15. It seems like issues with prisma not generating my entities.
[ Wasp ] entities/index.ts(11,8): error TS2305: Module '"@prisma/client"' has no exported member 'TeamPlayer'.
[ Wasp ] entities/index.ts(12,8): error TS2305: Module '"@prisma/client"' has no exported member 'Summoner'.
[ Wasp ] entities/index.ts(13,8): error TS2305: Module '"@prisma/client"' has no exported member 'Rank'.
[ Wasp ] entities/index.ts(14,8): error TS2305: Module '"@prisma/client"' has no exported member 'File'.
[ Wasp ] entities/index.ts(15,8): error TS2305: Module '"@prisma/client"' has no exported member 'Event'.
[ Wasp ] entities/index.ts(16,8): error TS2305: Module '"@prisma/client"' has no exported member 'Match'.
[ Wasp ] entities/index.ts(17,8): error TS2305: Module '"@prisma/client"' has no exported member 'MatchTeam'.
[ Wasp ] entities/index.ts(18,8): error TS2305: Module '"@prisma/client"' has no exported member 'Ban'.
[ Wasp ] entities/index.ts(19,8): error TS2305: Module '"@prisma/client"' has no exported member 'Participant'.
[ Wasp ] entities/index.ts(11,8): error TS2305: Module '"@prisma/client"' has no exported member 'TeamPlayer'.
[ Wasp ] entities/index.ts(12,8): error TS2305: Module '"@prisma/client"' has no exported member 'Summoner'.
[ Wasp ] entities/index.ts(13,8): error TS2305: Module '"@prisma/client"' has no exported member 'Rank'.
[ Wasp ] entities/index.ts(14,8): error TS2305: Module '"@prisma/client"' has no exported member 'File'.
[ Wasp ] entities/index.ts(15,8): error TS2305: Module '"@prisma/client"' has no exported member 'Event'.
[ Wasp ] entities/index.ts(16,8): error TS2305: Module '"@prisma/client"' has no exported member 'Match'.
[ Wasp ] entities/index.ts(17,8): error TS2305: Module '"@prisma/client"' has no exported member 'MatchTeam'.
[ Wasp ] entities/index.ts(18,8): error TS2305: Module '"@prisma/client"' has no exported member 'Ban'.
[ Wasp ] entities/index.ts(19,8): error TS2305: Module '"@prisma/client"' has no exported member 'Participant'.
25 replies
WWasp-lang
Created by wardbox on 10/7/2024 in #đŸ™‹questions
AWS file upload query cache invalidation after creation
Using version 0.14.2 on MacOS I have a query to get a team
query getTeamById {
fn: import { getTeamById } from "@src/server/queries.js",
entities: [Team, Organization, OrganizationRole, File]
}
query getTeamById {
fn: import { getTeamById } from "@src/server/queries.js",
entities: [Team, Organization, OrganizationRole, File]
}
And the team returns a logo (File) if there is one
const team = await context.entities.Team.findFirstOrThrow({
where: {
id: id
},
include: {
logo: true,
}
});
const team = await context.entities.Team.findFirstOrThrow({
where: {
id: id
},
include: {
logo: true,
}
});
I also have a form that uploads a file and uses an action to do it.
action createFile {
fn: import { createFile } from "@src/server/actions.js",
entities: [User, Player, Team, File]
}
action createFile {
fn: import { createFile } from "@src/server/actions.js",
entities: [User, Player, Team, File]
}
return await context.entities.File.create({
data: {
name,
key,
uploadUrl,
type: fileType,
user: { connect: { id: context.user.id } },
team: {
connect: { id: teamId }
},
},
});
return await context.entities.File.create({
data: {
name,
key,
uploadUrl,
type: fileType,
user: { connect: { id: context.user.id } },
team: {
connect: { id: teamId }
},
},
});
When I upload the file and connect it to the team, I expect the getTeamById query to invalidate the cache since I have the File entity in the query and the Team entity in the createFile action. Right now when I upload a new photo, the query invalidates and errors out with a 404 from AWS because it can't find the file. If I do a full page refresh, it loads fine. Is there a way I could do a sleep or something to wait for it to finish uploading?
14 replies
WWasp-lang
Created by wardbox on 8/18/2024 in #đŸ™‹questions
how do I obtain a da boi plushy?
Where is the merch table at??
7 replies
WWasp-lang
Created by wardbox on 7/26/2024 in #đŸ™‹questions
How do you handle pagination with Wasp's useQuery?
I'd like to paginate my query but not sure on syntax or if it is supported. I see there's an old issue from 2021 here https://github.com/wasp-lang/wasp/issues/264 curious if others have found a way around it version: 0.14.0
5 replies
WWasp-lang
Created by wardbox on 7/18/2024 in #đŸ™‹questions
Trying to run wasp over https locally, permission denied
I'm trying to run wasp over https locally to test oauth that requires https. I tried using the plugin-basic-ssl that comes with vite like so and it actually worked for a bit, but I had to run sudo wasp start to get it to work. When i tried running it again I got issues with not being able to find some of my modules and it seems something odd is happening when building wasp with sudo. If i run without sudo I just get this error:
[ Client!] error when starting dev server:
[ Client!] Error: listen EACCES: permission denied 127.0.0.1:443
[ Client!] at Http2SecureServer.setupListenHandle [as _listen2] (node:net:1881:21)
[ Client!] at listenInCluster (node:net:1946:12)
[ Client!] at GetAddrInfoReqWrap.doListen [as callback] (node:net:2116:7)
[ Client!] at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:111:8)
[ Client!] error when starting dev server:
[ Client!] Error: listen EACCES: permission denied 127.0.0.1:443
[ Client!] at Http2SecureServer.setupListenHandle [as _listen2] (node:net:1881:21)
[ Client!] at listenInCluster (node:net:1946:12)
[ Client!] at GetAddrInfoReqWrap.doListen [as callback] (node:net:2116:7)
[ Client!] at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:111:8)
my vite config that worked with sudo wasp start
import { defineConfig } from "vite";
import basicSsl from "@vitejs/plugin-basic-ssl";

export default defineConfig({
server: {
open: false,
host: "local.mydomain.com",
port: 443,
},
plugins: [
basicSsl({
name: "test",
}),
],
});
import { defineConfig } from "vite";
import basicSsl from "@vitejs/plugin-basic-ssl";

export default defineConfig({
server: {
open: false,
host: "local.mydomain.com",
port: 443,
},
plugins: [
basicSsl({
name: "test",
}),
],
});
9 replies
WWasp-lang
Created by wardbox on 7/11/2024 in #đŸ™‹questions
Integrate custom oauth provider with wasp auth and session entities
I'm working on an app for League of Legends players. Riot Games provides Riot Sign On (RSO) so players can authenticate as their in-game account. Is there a way to do this with api endpoints or some other method since it isn't a supported auth method?
38 replies
WWasp-lang
Created by wardbox on 7/4/2024 in #đŸ™‹questions
Configure vite to resolve @ alias to src directory
Tried configuring like this and vscode seems happy with the path resolution but wasp doesn't, what am I missing?
// =============================== IMPORTANT =================================
//
// This file is only used for Wasp IDE support. You can change it to configure
// your IDE checks, but none of these options will affect the TypeScript
// compiler. Proper TS compiler configuration in Wasp is coming soon :)
{
"compilerOptions": {
"target": "esnext",
// We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly.
"moduleResolution": "bundler",
// JSX support
"jsx": "preserve",
"strict": true,
// Allow default imports.
"esModuleInterop": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"typeRoots": [
// This is needed to properly support Vitest testing with jest-dom matchers.
// Types for jest-dom are not recognized automatically and Typescript complains
// about missing types e.g. when using `toBeInTheDocument` and other matchers.
"node_modules/@testing-library",
// Specifying type roots overrides the default behavior of looking at the
// node_modules/@types folder so we had to list it explicitly.
// Source 1: https://www.typescriptlang.org/tsconfig#typeRoots
// Source 2: https://github.com/testing-library/jest-dom/issues/546#issuecomment-1889884843
"node_modules/@types"
],
// Since this TS config is used only for IDE support and not for
// compilation, the following directory doesn't exist. We need to specify
// it to prevent this error:
// https://stackoverflow.com/questions/42609768/typescript-error-cannot-write-file-because-it-would-overwrite-input-file
"outDir": ".wasp/phantom",
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
],
},
}
}
// =============================== IMPORTANT =================================
//
// This file is only used for Wasp IDE support. You can change it to configure
// your IDE checks, but none of these options will affect the TypeScript
// compiler. Proper TS compiler configuration in Wasp is coming soon :)
{
"compilerOptions": {
"target": "esnext",
// We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly.
"moduleResolution": "bundler",
// JSX support
"jsx": "preserve",
"strict": true,
// Allow default imports.
"esModuleInterop": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"typeRoots": [
// This is needed to properly support Vitest testing with jest-dom matchers.
// Types for jest-dom are not recognized automatically and Typescript complains
// about missing types e.g. when using `toBeInTheDocument` and other matchers.
"node_modules/@testing-library",
// Specifying type roots overrides the default behavior of looking at the
// node_modules/@types folder so we had to list it explicitly.
// Source 1: https://www.typescriptlang.org/tsconfig#typeRoots
// Source 2: https://github.com/testing-library/jest-dom/issues/546#issuecomment-1889884843
"node_modules/@types"
],
// Since this TS config is used only for IDE support and not for
// compilation, the following directory doesn't exist. We need to specify
// it to prevent this error:
// https://stackoverflow.com/questions/42609768/typescript-error-cannot-write-file-because-it-would-overwrite-input-file
"outDir": ".wasp/phantom",
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
],
},
}
}
import { defineConfig } from 'vite'
import * as path from 'path';

export default defineConfig({
server: {
open: false,
},
resolve: {
alias: [
{ find: '@', replacement: path.resolve(__dirname, 'src') },
],
},
})
import { defineConfig } from 'vite'
import * as path from 'path';

export default defineConfig({
server: {
open: false,
},
resolve: {
alias: [
{ find: '@', replacement: path.resolve(__dirname, 'src') },
],
},
})
5 replies
WWasp-lang
Created by wardbox on 5/9/2024 in #đŸ™‹questions
Is there a way to display a 404 for any routes not defined in main.wasp?
version: 0.13.2 on MacOS
16 replies
WWasp-lang
Created by wardbox on 4/25/2024 in #đŸ™‹questions
Typescript not validating included relation
This is likely due to my inexperience with typescript, but I've been trying to access a related property that I've included on a query, but for some reason typescript isn't validating that it's a valid property. I think it only has scalar properties available.
const { data: team, status } = useQuery(getTeamById, { id: props.match.params.id });
console.log(team.logo);
const { data: team, status } = useQuery(getTeamById, { id: props.match.params.id });
console.log(team.logo);
gives this error:
Property 'logo' does not exist on type 'GetResult<{ id: string; name: string; createdAt: Date; }, unknown> & {}'.ts(2339)
Property 'logo' does not exist on type 'GetResult<{ id: string; name: string; createdAt: Date; }, unknown> & {}'.ts(2339)
export const getTeamById: GetTeamById<{ id: string }, Team> = async ({ id }, context) => {
if (!context.user) {
throw new HttpError(401);
}

try {
const team = await context.entities.Team.findFirstOrThrow({
where: {
id: id
},
include: {
logo: true,
}
});
return team;
} catch (error: any) {
throw new HttpError(404, error.message);
}
}
export const getTeamById: GetTeamById<{ id: string }, Team> = async ({ id }, context) => {
if (!context.user) {
throw new HttpError(401);
}

try {
const team = await context.entities.Team.findFirstOrThrow({
where: {
id: id
},
include: {
logo: true,
}
});
return team;
} catch (error: any) {
throw new HttpError(404, error.message);
}
}
I'd expect prisma and/or wasp handles the types when i run wasp db migrate-dev , is that not correct?
23 replies