error

anyone know why im getting this
No description
32 Replies
b1nzee
b1nzee16mo ago
hmmmm, show your code?
dayflare
dayflare16mo ago
i havent edited it lol i just updated my npm cause of the djs update but
b1nzee
b1nzee16mo ago
hmmmm, thats weird. @Favna ?
dayflare
dayflare16mo ago
ever since it just spams this in the console i saw another post here about the same thing, but his node was outdated mine isnt
b1nzee
b1nzee16mo ago
which node version you using?
dayflare
dayflare16mo ago
v18.17.0
b1nzee
b1nzee16mo ago
hmmm, im on 18.50.0 but i cant see that making a huge difference we'll wait and see what Favna says
dayflare
dayflare16mo ago
yeah ive no clue i downgraded to ur version just to check if it was node that was the issue and it aint ripppp
/dayflare/Projects/NewCassie/node_modules/@sapphire/utilities/dist/lib/pollSync.js:10
AbortSignal.abort().reason.constructor
^

TypeError: Cannot read properties of undefined (reading 'constructor')
at Object.<anonymous> (/dayflare/Projects/NewCassie/node_modules/@sapphire/utilities/dist/lib/pollSync.js:10:29)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/dayflare/Projects/NewCassie/node_modules/@sapphire/utilities/dist/index.js:38:19)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
/dayflare/Projects/NewCassie/node_modules/@sapphire/utilities/dist/lib/pollSync.js:10
AbortSignal.abort().reason.constructor
^

TypeError: Cannot read properties of undefined (reading 'constructor')
at Object.<anonymous> (/dayflare/Projects/NewCassie/node_modules/@sapphire/utilities/dist/lib/pollSync.js:10:29)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/dayflare/Projects/NewCassie/node_modules/@sapphire/utilities/dist/index.js:38:19)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
the full error i temp fixed it by removing reason.constructor but idk how long this will last LOL
Lioness100
Lioness10016mo ago
I had this issue when running my code in my vscode debugger, but not when running it directly. I didn't troubleshoot it but I'll look into it next time if nobody resolves this first
Favna
Favna16mo ago
@kyra 🩵🩷🤍🩷🩵
kyra
kyra16mo ago
@dayflare eval or console.log process.version, please
dayflare
dayflare16mo ago
@kyra 🩵🩷🤍🩷🩵 v16.15.0 Sorry for the delay.
kyra
kyra16mo ago
Yeah so you're not on v18 Still, that shouldn't have failed, it doesn't in CI
dayflare
dayflare16mo ago
I updated to the latest node using nvm
dayflare
dayflare16mo ago
No description
kyra
kyra16mo ago
I recommend using Volta anyways, but however you're running your app, it's not using the host's Node version
dayflare
dayflare16mo ago
I'm using PM2 to keep it alive.
b1nzee
b1nzee16mo ago
Try start it without pm2 for a moment, just use node Get same error?
dayflare
dayflare16mo ago
Ah right, its now printing v18. Alright I rebuilt NPM and updated PM2 and it seems to be working now.
b1nzee
b1nzee16mo ago
Good stuff
dayflare
dayflare16mo ago
Thanks for your help 🙂 Although I do have another question if you don't mind- although it is small.
b1nzee
b1nzee16mo ago
Go ahead @dayflare
dayflare
dayflare16mo ago
My API Get Route isn't accepting any spaces in the Query Params and will throw 404 if there are any. Although if it's just one word without a space it works fine.
b1nzee
b1nzee16mo ago
Typically you shouldn't have a space in a URL What's the use-case here?
dayflare
dayflare16mo ago
@ApplyOptions<Route.Options>({
route: 'getrolemembers/role/:role'
})
export class UserRoute extends Route {
public [methods.GET](_request: ApiRequest, response: ApiResponse) {
if (validateApi(_request) == true) {
var { client } = this.container;

var guild = client.guilds.cache.find(r=>r.id==process.env.PRIMARYGUILD)
guild?.members.fetch()

var role = guild?.roles.cache.find(r=>r.name==_request.params.role.replace("%20", " "))

response.json({ success: true, data: role?.members.map(m => m.user.id)})
}
}
}
@ApplyOptions<Route.Options>({
route: 'getrolemembers/role/:role'
})
export class UserRoute extends Route {
public [methods.GET](_request: ApiRequest, response: ApiResponse) {
if (validateApi(_request) == true) {
var { client } = this.container;

var guild = client.guilds.cache.find(r=>r.id==process.env.PRIMARYGUILD)
guild?.members.fetch()

var role = guild?.roles.cache.find(r=>r.name==_request.params.role.replace("%20", " "))

response.json({ success: true, data: role?.members.map(m => m.user.id)})
}
}
}
b1nzee
b1nzee16mo ago
In the front-end Try and do it like /role%20name Cause yeah, URLs don't contain spaces, a space is represented by a %20 Which your code is already replacing the %20, so you must've already been somewhat aware of this
dayflare
dayflare16mo ago
Yeah I knew that but it just generally wasn't sending, lemme try this rq.
b1nzee
b1nzee16mo ago
A little side note, make sure your your primary server has a privacy policy / user consent for sharing their user ID's to a third party
dayflare
dayflare16mo ago
Yeah, I think I've found the issue, probably best if I move over to Role ID's to be honest being some of my roles contain special characters which don't have URL support.
b1nzee
b1nzee16mo ago
Cause if you type a URL with a space in a browser, it just Google's it too
No description
dayflare
dayflare16mo ago
Yeah, thanks for the help anyway been a big help haha 🙂
b1nzee
b1nzee16mo ago
No problem Also, you could always use a POST request and pass a role name to the body, that will parse your special characters
Want results from more Discord servers?
Add your server