Nick
Nick
Explore posts from servers
DTDrizzle Team
Created by Nick on 6/18/2024 in #help
Trying to get Drizzle, Lucia and Vercel-postress to work together (no changes to schema detected)
Hi! I'm new to drizzle and lucia and am just having a problem setting up both with vercel-postgres: I'm creating an adapter for Lucia in my schema.ts: export const createAdapter = (db: PgDatabase<any, any, any>) => new DrizzlePostgreSQLAdapter(db, sessionTable, userTable); and using it in db/index.ts. But this doesn't allow drizzle to see the session or user schemas (no changes are detected when I drizzle-kit push )
import { drizzle } from "drizzle-orm/vercel-postgres";
import { sql } from "@vercel/postgres";
import * as schema from "./schema";

export const db = drizzle(sql, { schema });
export const adapter = schema.createAdapter(db);
import { drizzle } from "drizzle-orm/vercel-postgres";
import { sql } from "@vercel/postgres";
import * as schema from "./schema";

export const db = drizzle(sql, { schema });
export const adapter = schema.createAdapter(db);
Any ideas? Sorry if it's obvious! Nick
7 replies
KPCKevin Powell - Community
Created by Nick on 6/1/2024 in #front-end
Intrinsic image sizes
Just looking to optimize my images (actually using Astro, but I'm leaning towards the raw picture tag because it seems like it has more flexibility) The width and height attributes are intrinsic values right? ie not how big I'd like to render the image, but how big the image is on my HDD. I swear I see the former definition used everywhere? I'd then use the sizes attribute (in a picture tag) or css to set the render sizes with relevant breakpoints? Thanks, Nick
4 replies
KPCKevin Powell - Community
Created by Nick on 5/23/2024 in #os-and-tools
Alias'ing an MS exchange email address
Sorry if this is a simple question, but I'm always wary/shit-scared of messing with emails/dns πŸ˜„ I'm using a primary domain on O365, exampleA.com, with licenses and users set up, and have another unrelated domain, exampleB.com, with no licenses. I'd like to alias me@exampleA.com, with me@exampleB.com, so that anyone emailing @exampleB.com will actually mail @exampleA.com. I've found an MS guide here: https://learn.microsoft.com/en-us/microsoft-365/admin/setup/add-domain?view=o365-worldwide but just wanted to ask "is this doing what I think it's doing", and if any replies would appear as being from exampleB.com or if it will default to exampleA.com? Thanks!
3 replies
KPCKevin Powell - Community
Created by Nick on 5/14/2024 in #back-end
DMARC: None vs Quarantine
Anyone mind ELI5 the difference between my DMARC policy of 'none' and more proactive policies? Afaik 'none' should count as having DMARC set up, but doesn't prevent spam? But should I be wary of setting it to 'quarantine'?
1 replies
KPCKevin Powell - Community
Created by Nick on 5/13/2024 in #front-end
Tracking scripts failing on deployment
Hi all, Not really something I've messed about with but I keep trying to add tracking scripts to a site and they keep failing. Running locally gets this error:
Uncaught TypeError: Cannot set properties of undefined (setting 'q')
and uploading to cloudflare gets this, followed by other errors (all pointing to the tracking script):
src/layouts/main-layout.astro:32:917 - error ts(2304): Cannot find name 'd'.
<!-- <script>window.faitracker=window.faitracker||function(){this.q=[];var t=new CustomEvent("FAITRACKER_QUEUED_EVENT");return this.init=function(t,e,a){this.TOKEN=t,this.INIT_PARAMS=e,this.INIT_CALLBACK=a,window.dispatchEvent(new CustomEvent("FAITRACKER_INIT_EVENT"))},this.call=function(){var e={k:"",a:[]};if(arguments&&arguments.length>=1){for(var a=1;a<arguments.length;a++)e.a.push(arguments[a]);e.k=arguments[0]}this.q.push(e),window.dispatchEvent(t)},this.message=function(){window.addEventListener("message",function(t){"faitracker"===t.data.origin&&this.call("message",t.data.type,t.data.message)})},this.message(),this.init("key",{host:"https://api.factors.ai"}),this}(),function(){var t=document.createElement("script");t.type="text/javascript",t.src="https://app.factors.ai/assets/factors.js",t.async=!0,(d=document.getElementsByTagName("script")[0]).parentNode.insertBefore(t,d)}();</script> -->
<!-- <script>window.faitracker=window.faitracker||function(){this.q=[];var t=new CustomEvent("FAITRACKER_QUEUED_EVENT");return this.init=function(t,e,a){this.TOKEN=t,this.INIT_PARAMS=e,this.INIT_CALLBACK=a,window.dispatchEvent(new CustomEvent("FAITRACKER_INIT_EVENT"))},this.call=function(){var e={k:"",a:[]};if(arguments&&arguments.length>=1){for(var a=1;a<arguments.length;a++)e.a.push(arguments[a]);e.k=arguments[0]}this.q.push(e),window.dispatchEvent(t)},this.message=function(){window.addEventListener("message",function(t){"faitracker"===t.data.origin&&this.call("message",t.data.type,t.data.message)})},this.message(),this.init("key",{host:"https://api.factors.ai"}),this}(),function(){var t=document.createElement("script");t.type="text/javascript",t.src="https://app.factors.ai/assets/factors.js",t.async=!0,(d=document.getElementsByTagName("script")[0]).parentNode.insertBefore(t,d)}();</script> -->
Anyone got any ideas? I'm stumped. 🧐
1 replies
CDCloudflare Developers
Created by Nick on 5/13/2024 in #general-help
Tracking script failing on deployment
I'm trying to add this tracking script to my site, but it's failing on deployment with the error (and many others that follow it):
src/layouts/main-layout.astro:32:917 - error ts(2304): Cannot find name 'd'.
they all point to the script. Looks like a typescript error, but I'm not really sure what to do with it?
<!-- <script>window.faitracker=window.faitracker||function(){this.q=[];var t=new CustomEvent("FAITRACKER_QUEUED_EVENT");return this.init=function(t,e,a){this.TOKEN=t,this.INIT_PARAMS=e,this.INIT_CALLBACK=a,window.dispatchEvent(new CustomEvent("FAITRACKER_INIT_EVENT"))},this.call=function(){var e={k:"",a:[]};if(arguments&&arguments.length>=1){for(var a=1;a<arguments.length;a++)e.a.push(arguments[a]);e.k=arguments[0]}this.q.push(e),window.dispatchEvent(t)},this.message=function(){window.addEventListener("message",function(t){"faitracker"===t.data.origin&&this.call("message",t.data.type,t.data.message)})},this.message(),this.init("key",{host:"https://api.factors.ai"}),this}(),function(){var t=document.createElement("script");t.type="text/javascript",t.src="https://app.factors.ai/assets/factors.js",t.async=!0,(d=document.getElementsByTagName("script")[0]).parentNode.insertBefore(t,d)}();</script> -->
<!-- <script>window.faitracker=window.faitracker||function(){this.q=[];var t=new CustomEvent("FAITRACKER_QUEUED_EVENT");return this.init=function(t,e,a){this.TOKEN=t,this.INIT_PARAMS=e,this.INIT_CALLBACK=a,window.dispatchEvent(new CustomEvent("FAITRACKER_INIT_EVENT"))},this.call=function(){var e={k:"",a:[]};if(arguments&&arguments.length>=1){for(var a=1;a<arguments.length;a++)e.a.push(arguments[a]);e.k=arguments[0]}this.q.push(e),window.dispatchEvent(t)},this.message=function(){window.addEventListener("message",function(t){"faitracker"===t.data.origin&&this.call("message",t.data.type,t.data.message)})},this.message(),this.init("key",{host:"https://api.factors.ai"}),this}(),function(){var t=document.createElement("script");t.type="text/javascript",t.src="https://app.factors.ai/assets/factors.js",t.async=!0,(d=document.getElementsByTagName("script")[0]).parentNode.insertBefore(t,d)}();</script> -->
1 replies
KPCKevin Powell - Community
Created by Nick on 5/11/2024 in #os-and-tools
I'm getting an ENOENT error when running create-next-app (or similar)
I've been told it might be because I've a space in my username, which is nuts imo, given it seems overly complicated to change (windows 11). I've been coding for about a month on this laptop with no issues (granted, using Astro and React). But I checked a similar tool - create-react-app - and suffered the same thing. Anyone know what the problem is for sure/any advice?
npm ERR! path C:\Users\Nick Woodward\AppData\Roaming\npm npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\Nick Woodward\AppData\Roaming\npm'
10 replies
KPCKevin Powell - Community
Created by Nick on 4/28/2024 in #os-and-tools
DNS records when moving from Digital Ocean to Cloudflare
Hi all, Was just hoping for some help moving my site and keeping my emails up and running! My registrar is GoDaddy, site on DO, and new site on Cloudflare. I've created a short checklist of records I need, but I've two questions: 1) Have I missed anything obvious? and 2) should the records remain the same despite the move? (yes?). And I guess I might as well ask another: Should I be getting someone else to do this? Feel like it should be easy, but don't want the email to silently fail. Checklist: MX records -> point to x.mail.protection.outlook TXT for dmarc 2 CNAMES for DKIM pointing to MS An external dns for o365 eg: MS=ms93647839 A CNAME for o365 autodiscover An spf txt CNAMES for sendgrid A records and NS Look right? Thanks πŸ™‚
9 replies
CDCloudflare Developers
Created by Nick on 4/28/2024 in #general-help
Moving site + emails to Cloudflare pages (from Digital Ocean)
Hey all, anyone know of any good resources for transferring a site (and more importantly email) from digital ocean to cloudflare? Just looking for a checklist more than a handhold, but it is important that emails are working tomorrow, so I'd take the handhold πŸ˜„ I'm thinking: MX records -> point to x.mail.protection.outlook TXT for dmarc 2 CNAMES for DKIM pointing to MS An external dns for o365 eg: MS=ms93647839 A CNAME for o365 autodiscover An spf txt CNAMES for sendgrid A records and NS I've currently got the records in DO afaik, is there anything above I've missed, or anything that might change based on the fact that I'm moving from DO to CF? Email registrar is GoDaddy. Appreciate it **also happy to be told I shouldn't do it
4 replies
KPCKevin Powell - Community
Created by Nick on 4/27/2024 in #os-and-tools
Github blocked push due to secrets
It was right, my rest.http file was misspelt in my gitignore. But now it's correct and git is still blocking me, I'm assuming because the file is in an older commit? Does anyone know how I can solve this please? Thanks
3 replies
CDCloudflare Developers
Created by Nick on 4/26/2024 in #general-help
Pages: Failed to publish your Function.
Hi all, just getting this error when trying to deploy an astro ssr (with the cloudflare integration):
Error: Failed to publish your Function. Got error: Uncaught Error: No such module "chunks/prerender_BU2rOQkH.mjs". imported from "renderers.mjs"
I'm not going to lie, I have very little idea where to start or what it's actually complaining about. Would appreciate some advice! *edit: The log in case it helps:
05:44:36.224 ✨ Compiled Worker successfully 05:44:36.272 Found _routes.json in output directory. Uploading. 05:44:36.291 Validating asset output directory 05:44:37.259 Deploying your site to Cloudflare's global network... 05:44:40.757 Uploading... (44/44) 05:44:40.758 ✨ Success! Uploaded 0 files (44 already uploaded) (0.34 sec) 05:44:40.758
05:44:41.187 ✨ Upload complete! 05:44:44.175 Success: Assets published! 05:44:45.813 Error: Failed to publish your Function. Got error: Uncaught Error: No such module "chunks/prerender_BU2rOQkH.mjs". imported from "renderers.mjs"
11 replies
CDCloudflare Developers
Created by Nick on 4/21/2024 in #general-help
Multiple Turnstile widgets on a page
I was just wondering why it would be necessary to have multiple turnstile widgets on a page? Could I have one, and for every form I just get the widget's state? Or does the problem become when you need to render the widget - you need it to be near the form? I was just thinking if it would be possible to have one widget, and then FLIP or rerender that widget into a portal/modal? Thanks, Nick
1 replies
CDCloudflare Developers
Created by Nick on 4/17/2024 in #general-help
Restricting worker access?
Hi, is it possible to restrict the domain that workers are called from?
6 replies
KPCKevin Powell - Community
Created by Nick on 4/6/2024 in #os-and-tools
How to execute this powershell script? (Defederating GoDaddy o365)
Hey all, trying to get the hell away from GoDaddy and using the defederating guide here: https://tminus365.com/defederating-godaddy-365/ It provides a script here:
Write-Host "Checking for MSGraph module..."

$Module = Get-Module -Name "Microsoft.Graph.Identity.DirectoryManagement" -ListAvailable

if ($Module -eq $null) {

Write-Host "MSGraph module not found, installing MSGraph"
Install-Module -name Microsoft.Graph.Identity.DirectoryManagement

}
Connect-MgGraph -Scopes "Directory.Read.All","Domain.Read.All","Domain.ReadWrite.All","Directory.AccessAsUser.All"
#Enter the Admin credentials from "Become a tenant Admin in GoDaddy"

Get-MgDomain
#See that the domain is β€œfederated”#

Update-MgDomain -DomainId "<InsertFederatedDomain>" -Authentication Managed
Write-Host "Checking for MSGraph module..."

$Module = Get-Module -Name "Microsoft.Graph.Identity.DirectoryManagement" -ListAvailable

if ($Module -eq $null) {

Write-Host "MSGraph module not found, installing MSGraph"
Install-Module -name Microsoft.Graph.Identity.DirectoryManagement

}
Connect-MgGraph -Scopes "Directory.Read.All","Domain.Read.All","Domain.ReadWrite.All","Directory.AccessAsUser.All"
#Enter the Admin credentials from "Become a tenant Admin in GoDaddy"

Get-MgDomain
#See that the domain is β€œfederated”#

Update-MgDomain -DomainId "<InsertFederatedDomain>" -Authentication Managed
But I'm just unsure how to implement this? Like obviously I replace <InsertFederatedDomain> with my domain, but in what format do I enter my credentials above? Is this script supposed to be run at once? Because it looks like it should be run in split into at least 4 stages (Write-Host,Connect-MgGraph,Get-MgDomain and Update-MgDomain) Anyone got any tips? Even if you've just got a slightly better grasp than me it would be appreciated! πŸ™‚ Larse.
1 replies
CDCloudflare Developers
Created by Nick on 3/25/2024 in #general-help
Is it possible to run Mailgun/Sendgrid/a package that needs node in Cloudflare workers?
Hi, I've just uploaded my first site to pages, and then found out that my API Route (astro ssr) was assuming a node environment. It's only there to use Mailgun or Sendrid, but both seem to need node. Is there any work around here? Thanks, Nick
4 replies