Alejo
Alejo
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 10/2/2023 in #questions
s3 type error
Env variables can be undefined, so Typescript's type for an env var is string | undefined, if you have a type string you cannot assign it string | undefined because string is not undefined, if you want to tell TS that a variable/property is NOT undefined, you can append ! at the end, so in this case you could do this and should be fine:
export const r2 =
globalForR2.r2 ||
new S3Client({
region: "auto",
endpoint: process.env.AWS_ENDPOINT!,
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY!,
},
});
export const r2 =
globalForR2.r2 ||
new S3Client({
region: "auto",
endpoint: process.env.AWS_ENDPOINT!,
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY!,
},
});
6 replies
TTCTheo's Typesafe Cult
Created by Ducky Sensei on 8/30/2023 in #questions
Prisma/Planetscale issue
The other option would be to use a special separator and use a LIKE query(i.e. WHERE allowedDomains LIKE 'domain.com|%' OR allowedDomains LIKE '%|domain.com|%' allowedDomains LIKE '%|domain.com' ), but that's prone to errors and, like Christoph said, the way it is normally done is using a separate model and table
10 replies
TTCTheo's Typesafe Cult
Created by George on 8/23/2023 in #questions
Email Attachments without creating a file
Based on the docs you linked, you could base64 encode it to send it
const attachments = [
...
{ // encoded string as an attachment
filename: 'text1.txt',
content: 'aGVsbG8gd29ybGQh',
encoding: 'base64'
},
{ // data uri as an attachment
path: 'data:text/plain;base64,aGVsbG8gd29ybGQ='
},
...
];
const attachments = [
...
{ // encoded string as an attachment
filename: 'text1.txt',
content: 'aGVsbG8gd29ybGQh',
encoding: 'base64'
},
{ // data uri as an attachment
path: 'data:text/plain;base64,aGVsbG8gd29ybGQ='
},
...
];
Or you can also use ReactPDF.renderToStream to attach it as a Buffer (See https://github.com/diegomura/react-pdf/issues/582)
const attachments = [
...
{ // binary buffer as an attachment
filename: 'text2.txt',
content: buffer
}
...
];
const attachments = [
...
{ // binary buffer as an attachment
filename: 'text2.txt',
content: buffer
}
...
];
4 replies
TTCTheo's Typesafe Cult
Created by ~Abhinav on 5/18/2023 in #questions
Typescript error for "property does not exist', when it clearly does.
The way Typescript works, it prevents you from calling properties that may not exist in an object, not existing is not the same as being undefined for Typescript In your case, what seems to be happening is that this interface/type is an Discriminating Union type, something along the lines of
type A = {
a: string;
b: string;
c: string;
}
type B = {
a: string;
b: string;
c: string;
programSecTitle: string;
}
type C = A | B
type A = {
a: string;
b: string;
c: string;
}
type B = {
a: string;
b: string;
c: string;
programSecTitle: string;
}
type C = A | B
You can read more about it here: https://www.typescriptlang.org/docs/handbook/unions-and-intersections.html Because of this, Typescript cannot guarantee that programSecTitle is a field in type C, since it may not exist in type A, checking for "programSecTitle" in program narrows down the type to B and now typescript can guarantee that property exists
4 replies
TTCTheo's Typesafe Cult
Created by ~Abhinav on 5/18/2023 in #questions
Typescript error for "property does not exist', when it clearly does.
Does it work if you do "programSecTitle" in program && instead of program.programSecTitle &&?
4 replies
TTCTheo's Typesafe Cult
Created by ceespert on 5/15/2023 in #questions
Keep getting "NEXTAUTH_URL: [ 'String must contain at least 1 character(s)' ]"
You can just set it to http://localhost:3000 or whatever port you are using locally
4 replies
TTCTheo's Typesafe Cult
Created by NotMe on 5/10/2023 in #questions
Firebase deployment
Oooh, interesting lynNote
16 replies
TTCTheo's Typesafe Cult
Created by NotMe on 5/10/2023 in #questions
Firebase deployment
If removing/renaming it before deploys works, then you may want to look into adding it to the ignore field in the firebase.json file, I think these are the right docs https://firebase.google.com/docs/hosting/full-config#ignore, may just need to do it inside "functions" rather than "hosting"
16 replies
TTCTheo's Typesafe Cult
Created by NotMe on 5/10/2023 in #questions
Firebase deployment
(Sorry for the late reply, busy day yesterday 😅 )
16 replies
TTCTheo's Typesafe Cult
Created by NotMe on 5/10/2023 in #questions
Firebase deployment
Seems like it may be overriding whatever you have set in DATABASE_URL on cloud functions
16 replies
TTCTheo's Typesafe Cult
Created by NotMe on 5/10/2023 in #questions
Firebase deployment
Have you tried deleting / removing your .env file from the deployment?
16 replies
TTCTheo's Typesafe Cult
Created by NotMe on 5/10/2023 in #questions
Firebase deployment
thonkku
16 replies
TTCTheo's Typesafe Cult
Created by NotMe on 5/10/2023 in #questions
Firebase deployment
Do you have any detailed errors? Did you double-check your environment variables?
16 replies
TTCTheo's Typesafe Cult
Created by stillmotion on 5/8/2023 in #questions
Error: npm lint not seeing env type
Yeah, seems like like an odd config issue, are you maybe on an old version of node or typescript or something?
18 replies
TTCTheo's Typesafe Cult
Created by stillmotion on 5/8/2023 in #questions
Error: npm lint not seeing env type
Seems like VSCode eslint extension may be loading default configs instead of the proper .eslintrc file
18 replies
TTCTheo's Typesafe Cult
Created by stillmotion on 5/8/2023 in #questions
Error: npm lint not seeing env type
Ah, I thought this error was when you ran eslint, not a VSCode-only error
18 replies
TTCTheo's Typesafe Cult
Created by stillmotion on 5/8/2023 in #questions
Error: npm lint not seeing env type
by default most projects have .eslinrc.json whereas ct3a uses a .cjs file
18 replies