error

anyone know why im getting this
No description
32 Replies
b1nzee
b1nzee2y ago
hmmmm, show your code?
dayflare
dayflareOP2y ago
i havent edited it lol i just updated my npm cause of the djs update but
b1nzee
b1nzee2y ago
hmmmm, thats weird. @Favna ?
dayflare
dayflareOP2y 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
b1nzee2y ago
which node version you using?
dayflare
dayflareOP2y ago
v18.17.0
b1nzee
b1nzee2y 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
dayflareOP2y 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
Lioness1002y 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
Favna2y ago
@kyra 🩵🩷🤍🩷🩵
kyra
kyra2y ago
@dayflare eval or console.log process.version, please
dayflare
dayflareOP2y ago
@kyra 🩵🩷🤍🩷🩵 v16.15.0 Sorry for the delay.
kyra
kyra2y ago
Yeah so you're not on v18 Still, that shouldn't have failed, it doesn't in CI
dayflare
dayflareOP2y ago
I updated to the latest node using nvm
dayflare
dayflareOP2y ago
No description
kyra
kyra2y ago
I recommend using Volta anyways, but however you're running your app, it's not using the host's Node version
dayflare
dayflareOP2y ago
I'm using PM2 to keep it alive.
b1nzee
b1nzee2y ago
Try start it without pm2 for a moment, just use node Get same error?
dayflare
dayflareOP2y ago
Ah right, its now printing v18. Alright I rebuilt NPM and updated PM2 and it seems to be working now.
b1nzee
b1nzee2y ago
Good stuff
dayflare
dayflareOP2y ago
Thanks for your help 🙂 Although I do have another question if you don't mind- although it is small.
b1nzee
b1nzee2y ago
Go ahead @dayflare
dayflare
dayflareOP2y 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
b1nzee2y ago
Typically you shouldn't have a space in a URL What's the use-case here?
dayflare
dayflareOP2y 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
b1nzee2y 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
dayflareOP2y ago
Yeah I knew that but it just generally wasn't sending, lemme try this rq.
b1nzee
b1nzee2y 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
dayflareOP2y 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
b1nzee2y ago
Cause if you type a URL with a space in a browser, it just Google's it too
No description
dayflare
dayflareOP2y ago
Yeah, thanks for the help anyway been a big help haha 🙂
b1nzee
b1nzee2y 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

Did you find this page helpful?