Lambo
Lambo
Explore posts from servers
CDCloudflare Developers
Created by Lambo on 6/2/2024 in #pages-help
Mono Repo Deployment With Root Directory
Hi there, I have my Cloudflare Pages site within a mono repo along side my workers. This has worked well, however, I have recently started breaking my code up into several packages via NPM workspaces. This means that the functions/tsconfig.json is extending the one in the root of my mono repo, to avoid having duplicated config. However, because I have the root directory configured to be the pages directory in my mono repo, it can not obviously find the root tsconfig.json I can see two potential fixes to this: - Do not set pages as a root directory, but this would mean pushing more than I need to Pages - Do not extend the functions tsconfig.json and duplicate the config Neither of these approaches seem ideal, does anyone have any other suggestions or recomend a certain way? Thanks
1 replies
DIAdiscord.js - Imagine an app
Created by Lambo on 4/19/2024 in #djs-voice
Bot Works Locally, In Production Player States Goes To Idle Straight Away?
Hi, I'm having an issue with my bot in production. It works fine locally (macOS), but in production (Docker node:20 image), the player state changes from playing to idle straight away:
2024-04-19T21:18:59.218838568Z Player state changed from idle to buffering 2024-04-19T21:18:59.219003344Z Player state changed from idle to buffering 2024-04-19T21:18:59.219081585Z Player state changed from idle to buffering 2024-04-19T21:18:59.219159240Z Player state changed from idle to buffering 2024-04-19T21:18:59.424853162Z Player state changed from buffering to playing 2024-04-19T21:18:59.424882300Z Player state changed from buffering to playing 2024-04-19T21:18:59.424931457Z Player state changed from buffering to playing 2024-04-19T21:18:59.425016947Z Player state changed from buffering to playing 2024-04-19T21:18:59.559298570Z Player state changed from playing to idle 2024-04-19T21:18:59.559400012Z Player state changed from playing to idle 2024-04-19T21:18:59.559409250Z Player state changed from playing to idle 2024-04-19T21:18:59.559414376Z Player state changed from playing to idle
2024-04-19T21:18:59.218838568Z Player state changed from idle to buffering 2024-04-19T21:18:59.219003344Z Player state changed from idle to buffering 2024-04-19T21:18:59.219081585Z Player state changed from idle to buffering 2024-04-19T21:18:59.219159240Z Player state changed from idle to buffering 2024-04-19T21:18:59.424853162Z Player state changed from buffering to playing 2024-04-19T21:18:59.424882300Z Player state changed from buffering to playing 2024-04-19T21:18:59.424931457Z Player state changed from buffering to playing 2024-04-19T21:18:59.425016947Z Player state changed from buffering to playing 2024-04-19T21:18:59.559298570Z Player state changed from playing to idle 2024-04-19T21:18:59.559400012Z Player state changed from playing to idle 2024-04-19T21:18:59.559409250Z Player state changed from playing to idle 2024-04-19T21:18:59.559414376Z Player state changed from playing to idle
This is from:
player.on('stateChange', (oldState, newState) => {
console.log(`Player state changed from ${oldState.status} to ${newState.status}`)
})
player.on('stateChange', (oldState, newState) => {
console.log(`Player state changed from ${oldState.status} to ${newState.status}`)
})
Does anyone have some pointers as to thing I should check, as to why this may occur? Thanks
12 replies
DIAdiscord.js - Imagine an app
Created by Lambo on 3/11/2024 in #djs-questions
Discord.js 14.14.1 Type Errors
Hi, I'm trying to upgrade from 14.7.1 to 14.14.1. However, when I now go to transpile my code I get 97 errors from the Discord.js typings folder. I have skipLibCheck enabled in my TSConfig, so I'm not sure what's going on here. Any ideas? (node 20.11.1)
3 replies
CDCloudflare Developers
Created by Lambo on 12/10/2023 in #pages-help
Help With _routes.json File
Hello, I am a bit confused by the _routes.json file. I have added the file to my functions directory with the following config:
{
"version": 1,
"include": ["/*"],
"exclude": ["/", "manifest.json"]
}
{
"version": 1,
"include": ["/*"],
"exclude": ["/", "manifest.json"]
}
I have another file [article].ts in my functions folder with the following code, for testing purposes:
export function onRequest(context) {
console.log('Hit: ' + context.params.article);
return new Response(context.params.article);
}
export function onRequest(context) {
console.log('Hit: ' + context.params.article);
return new Response(context.params.article);
}
My understanding of the _routes.json is that I should not see a Hit log for when I visit my Pages site at http://localhost:8788, however, I see Hit: manifest.json in the logs (nothing for the index route itself). Why is this? Essentially, what I am after is for the static page to load for /, but then all other routes to fallback to my [article].ts function.
1 replies
CDCloudflare Developers
Created by Lambo on 11/29/2023 in #workers-help
Scheduled Worker 504 Gateway Time-out
Hello, I'm suddenly getting a 504 Gateway Time-out when visting http://localhost:8787/__scheduled?cron=*+*+*+*+* to test my scheduled worker via npx wrangler dev --test-scheduled. This only happens when local mode is turned off. If local mode is enabled I just get an error in the console stating the table does not exist (which is correct). I'm not really sure what could have caused this. I am on my master branch which was working a couple days ago, so I have changed no code. Does anyone have ideas on what could cause this? Happy to supply any code/config. Thanks.
6 replies
DIAdiscord.js - Imagine an app
Created by Lambo on 3/10/2023 in #djs-voice
No Audio Is Played
Hello! I'm new to using @discordjs/voice so I'm hoping I'm just missing something simple. I'm trying to get my bot to play a local audio file within voice. The bot joins the channel, but doesn't make a noise. This is the relevant code:
const player = createAudioPlayer({
debug: true,
});

const resource = createAudioResource(`/Volumes/Files/audio/music.ogg`);
const connection = joinVoiceChannel({
adapterCreator: channel.guild.voiceAdapterCreator,
guildId: channel.guild.id,
channelId: channel.id,
});

connection.subscribe(player);
connection.on("stateChange", (oldState, newState) => {
if (
oldState.status === VoiceConnectionStatus.Ready &&
newState.status === VoiceConnectionStatus.Connecting
) {
connection.configureNetworking();
}
});

player.play(resource);
player.unpause();
const player = createAudioPlayer({
debug: true,
});

const resource = createAudioResource(`/Volumes/Files/audio/music.ogg`);
const connection = joinVoiceChannel({
adapterCreator: channel.guild.voiceAdapterCreator,
guildId: channel.guild.id,
channelId: channel.id,
});

connection.subscribe(player);
connection.on("stateChange", (oldState, newState) => {
if (
oldState.status === VoiceConnectionStatus.Ready &&
newState.status === VoiceConnectionStatus.Connecting
) {
connection.configureNetworking();
}
});

player.play(resource);
player.unpause();
I was wondering if anyone could point me in the direction of the cause? The bot is auto-pausing so I believe it is do with the resource. Thank you! discord.js@14.7.1 @discordjs/voice@0.14.0 node v18.13.0
50 replies