Gwaggli
Gwaggli
WWasp-lang
Created by Gwaggli on 9/29/2024 in #đŸ™‹questions
Different Root Components for Pages
Is there a possibility to define multiple root components and assign them in the wasp config file per page? So instead of one global root component i would want something like:
route HomeRoute { path: "/", to: Home }
page Home {
authRequired: true,
component: import Main from "@src/client/pages/home"
rootComponent: import RootForLoggedInUsers from "@src/client/root/root-for-logged-in-users"
}
route HomeRoute { path: "/", to: Home }
page Home {
authRequired: true,
component: import Main from "@src/client/pages/home"
rootComponent: import RootForLoggedInUsers from "@src/client/root/root-for-logged-in-users"
}
This would allow for different setups for different roles / subpages? Some usecases: - Different Layouts for auhenticated pages vs public pages - Some pages need a Cookie Banner and some might not - I only need tracking / Analytics on some flows I know i could just inject these on demand in each PageComponent but was wondering what you guys think about a more modular approach to define this root component additionally per page instead of globally only.
9 replies
WWasp-lang
Created by Gwaggli on 8/30/2024 in #đŸ™‹questions
Enable SSH on Backend-Server
I recently migrated to Azure and would like to enable SSH to connect to the docker container for troubleshooting in case something goes wrong. I found this Guide on how to set this up: https://learn.microsoft.com/en-gb/azure/app-service/configure-custom-container?tabs=debian&pivots=container-linux#enable-ssh It needs me to add an sshd_config file on root level (i guess i would do this by cpy during build) and also modify the Dockerfile which is created during Build. I guess there is no way for me to modify this file without writing a script which manually inserts parts on specific lines. Any advice on this?
5 replies
WWasp-lang
Created by Gwaggli on 8/21/2024 in #đŸ™‹questions
Deploy Wasp App do Azure
Has anyone ever deployed a Wasp App to Azure and if so is there any guidance on how to do so? Preferably on how to do it via CI (Github Actions).
5 replies
WWasp-lang
Created by Gwaggli on 8/17/2024 in #đŸ™‹questions
Custom Type Declarations
I am trying to extend my @mui/material configuration and thus als its type declarations. When adding a declaration file mui.d.ts or mui.ts my local development works just fine (IDE Support and wasp start starts the server without problems) but when I try to deploy my app, the Typedefinition seems to get lost as i get the Error Property <MyAddedProperty> does not exist on Type XY. Any Idea how I can make this work?
10 replies
WWasp-lang
Created by Gwaggli on 4/10/2024 in #đŸ™‹questions
tsconfig update for v0.13.1
No description
39 replies
WWasp-lang
Created by Gwaggli on 3/29/2024 in #đŸ™‹questions
onAuthSucceededRedirectTo previous site
When I open a Link in my app where Auth is required but my session expired, I get redirected to the login site which is perfect. But i would love to make it possible to store the previous url so I get redirected to the previous page after successful login. Is something like this already possible and i just missed it or is it planned for the future? (or not at all?) I found this section in the docs, but it seems like it only supports static urls: https://wasp-lang.dev/docs/auth/overview#onauthsucceededredirectto-string
5 replies
WWasp-lang
Created by Gwaggli on 3/18/2024 in #đŸ™‹questions
wasp db reset showing help instructions
I am trying to setup a seed function and thus wanted to reset my db. According to the docs: https://wasp-lang.dev/docs/data-model/backends#running-seed-functions I am supposed to run wasp db reset. Sadly this only triggers the help call:
MyApp% wasp db reset
USAGE
wasp db <command> [command-args]

COMMANDS
start Alias for `wasp start db`.
reset Drops all data and tables from development database and re-applies all migrations.
seed [name] Executes a db seed function (specified via app.db.seeds).
If there are multiple seeds, you can specify a seed to execute by providing its name,
or if not then you will be asked to provide the name interactively.
migrate-dev Ensures dev database corresponds to the current state of schema(entities):
- Generates a new migration if there are changes in the schema.
- Applies any pending migrations to the database either using the
supplied migration name or asking for one.
OPTIONS:
--name [migration-name]
--create-only
studio GUI for inspecting your database.

EXAMPLES
wasp db migrate-dev
wasp db migrate-dev --name "Added User entity"
wasp db migrate-dev --create-only
wasp db studio
MyApp% wasp db reset
USAGE
wasp db <command> [command-args]

COMMANDS
start Alias for `wasp start db`.
reset Drops all data and tables from development database and re-applies all migrations.
seed [name] Executes a db seed function (specified via app.db.seeds).
If there are multiple seeds, you can specify a seed to execute by providing its name,
or if not then you will be asked to provide the name interactively.
migrate-dev Ensures dev database corresponds to the current state of schema(entities):
- Generates a new migration if there are changes in the schema.
- Applies any pending migrations to the database either using the
supplied migration name or asking for one.
OPTIONS:
--name [migration-name]
--create-only
studio GUI for inspecting your database.

EXAMPLES
wasp db migrate-dev
wasp db migrate-dev --name "Added User entity"
wasp db migrate-dev --create-only
wasp db studio
Is this a bug or am I being stupid? I also tested it with a new wasp app. Just set the db: System to PostgreSQL and ran wasp db migrate-dev and wasp db reset afterwards. Same outcome. PS: The code example has some minor issues in the createUser Method: 1. The variable is named prisma and not prismaClient 2. The password parameter of the sanitizeAndSerializeProviderData method is named hashedPassword
16 replies
WWasp-lang
Created by Gwaggli on 3/10/2024 in #đŸ™‹questions
fontsource not included in .wasp/out
I am using the @fontsource package to include google fonts and this was working just fine locally and on production. But since the migration to v.0.12 it is not working anymore locally. Vite complains with the following message:
The request url "/Users/path/to/repository/node_modules/@fontsource/roboto/files/roboto-latin-400-normal.woff2" is outside of Vite serving allow list.
The request url "/Users/path/to/repository/node_modules/@fontsource/roboto/files/roboto-latin-400-normal.woff2" is outside of Vite serving allow list.
Which makes sense as it is not inside the .wasp/out folder. Neither way of importing the @fontsource package works (from a .tsx file nor .scss) Am i missing something? The deployed version of the app works just fine.
17 replies
WWasp-lang
Created by Gwaggli on 3/7/2024 in #đŸ™‹questions
Set new Auth password with custom logic
Previous to upgrading Wasp i had a custom user interface to update the password which set the user.password property with some other custom logic. As i am now supposed to remove the password field from the user entity I was wondering how I would do this now that the password field was moved to the AuthIdentity Entity?
4 replies
WWasp-lang
Created by Gwaggli on 3/7/2024 in #đŸ™‹questions
Missing "./auth/email" specifier in "wasp" package
I have a Page where I import { login} from wasp/auth/email which worked perfectly on Version 0.11.X but now renders [plugin:vite:import-analysis] Missing "./auth/email" specifier in "wasp" package error. What does this error mean? Where do i need to specify ./auth/email? If i remove this import, the app renders just fine. My Wasp file looks like this
app AppName {
wasp: {
version: "^0.12.0"
},
// ...
auth: {
userEntity: User,
methods: {
email: {
fromField: {
name: "Name",
},
emailVerification: {
clientRoute: EmailVerificationRoute,
},
passwordReset: {
clientRoute: PasswordResetRoute,
},
}
},
onAuthFailedRedirectTo: "/login"
},
// ...
}
app AppName {
wasp: {
version: "^0.12.0"
},
// ...
auth: {
userEntity: User,
methods: {
email: {
fromField: {
name: "Name",
},
emailVerification: {
clientRoute: EmailVerificationRoute,
},
passwordReset: {
clientRoute: PasswordResetRoute,
},
}
},
onAuthFailedRedirectTo: "/login"
},
// ...
}
Ps: does it maybe make sense to add a Tag Migration to these questions here?
5 replies
WWasp-lang
Created by Gwaggli on 1/27/2024 in #đŸ™‹questions
experiences with testing the backend or e2e?
Hey all, Does someone here already have experience with testing the backend or e2e? According to the docs only frontend testing is currently supported. But I thought maybe someone has set up a custom testing infrastructure and would love to hear about it. How did you do it and can you recommend setting it up?
2 replies
WWasp-lang
Created by Gwaggli on 11/30/2023 in #đŸ™‹questions
Schedule email with sendgrid
According to the api of sendgrid you can schedule emails via the send_at header: https://docs.sendgrid.com/for-developers/sending-email/building-an-x-smtpapi-header#scheduling-your-send But this sadly does not seem to be possible using the wasp's emailSender api: https://wasp-lang.dev/docs/advanced/email#javascript-api. Is there a nice and clean workaround or is it planned to add more headers to the emailSender api?
51 replies
WWasp-lang
Created by Gwaggli on 9/30/2023 in #đŸ™‹questions
@types delcarations
When i add some @types/i18next.d.ts type declarations to my client-side it works fine when running locally but when trying to build the from the build folder it does not get anything referenced in the custom typedefinition file. VSC also shows this as valid inside the source files. But once in the build output directory, it does not seem to get the declarations anymore. Eventho VSC is able to list the file when cmd+clicking on the module name inside the build error, it is marked red. does anybody have a clue why this might be the case? Also moving around the typedefinition file inside the build folder manually or adding path/typeRoot to the tsconfig inside the build folder does not have any impact :S This is my declaration file:
import { TranslationsT } from '../translations/resources/de'
import { ParseKeys } from 'i18next'

declare module 'i18next' {
export type DefaultNS = 'translation'
export type Keys = ParseKeys<DefaultNS>
interface CustomTypeOptions {
defaultNS: DefaultNS
resources: {
translation: TranslationsT
}
}
}
import { TranslationsT } from '../translations/resources/de'
import { ParseKeys } from 'i18next'

declare module 'i18next' {
export type DefaultNS = 'translation'
export type Keys = ParseKeys<DefaultNS>
interface CustomTypeOptions {
defaultNS: DefaultNS
resources: {
translation: TranslationsT
}
}
}
3 replies
WWasp-lang
Created by Gwaggli on 9/26/2023 in #đŸ™‹questions
Custom loading screen
No description
10 replies
WWasp-lang
Created by Gwaggli on 5/30/2023 in #đŸ™‹questions
Return static files from the server
Is there a possibility to return files from the server app using res.sendFile()? If so, how would you include the assets folder in the output directory and reference it from the code? The functionality i want to achieve is to return an image based on some db calculated data. Its a small set of images, so a whole external image storage seems like overkill as its supposed to be around 6 images.
25 replies
WWasp-lang
Created by Gwaggli on 5/21/2023 in #đŸ™‹questions
File-Upload using a custom API
I am trying to setup a file upload using the custom apis. First i setup the fileupload-express middleware like this:
import fileUpload from 'express-fileupload'
import { ServerSetupFn } from '@wasp/types'

const serverSetup: ServerSetupFn = async ({ app }) => {
console.log('Setting up server...')
app.use(fileUpload({ createParentPath: true }))
}

export default serverSetup
import fileUpload from 'express-fileupload'
import { ServerSetupFn } from '@wasp/types'

const serverSetup: ServerSetupFn = async ({ app }) => {
console.log('Setting up server...')
app.use(fileUpload({ createParentPath: true }))
}

export default serverSetup
Which is called on startup. (confirmed via the console log statement) But the files and the body property stay empty no matter what.
export const fileUpload = (req, res, context) => {
console.log(req.get('Content-Type'))
console.log(req.body)
console.log(req.files)
res.json({ msg: `Hello, ${context.user?.email || "stranger"}!` })
}
export const fileUpload = (req, res, context) => {
console.log(req.get('Content-Type'))
console.log(req.body)
console.log(req.files)
res.json({ msg: `Hello, ${context.user?.email || "stranger"}!` })
}
Eventho the content type is defined as multipart/form-data and tried this with from within the webapp as well as directly from postman. Any ideas why this might not be working? The webapp code looks like this:
const uploadFile = async (data: FormData) => {
const res = await api.post(`/api/fileupload`, data, { headers: { 'Content-Type': 'multipart/form-data' } })
console.log(res.data)
}

// ...

const onSubmit = async (event: FormEvent<HTMLFormElement>) => {
event.preventDefault()
const data = new FormData()
data.append('file', event.currentTarget.file.files[0])
await uploadFile(data)
}
const uploadFile = async (data: FormData) => {
const res = await api.post(`/api/fileupload`, data, { headers: { 'Content-Type': 'multipart/form-data' } })
console.log(res.data)
}

// ...

const onSubmit = async (event: FormEvent<HTMLFormElement>) => {
event.preventDefault()
const data = new FormData()
data.append('file', event.currentTarget.file.files[0])
await uploadFile(data)
}
4 replies