Killshot
Killshot
WWasp
Created by Killshot on 3/6/2024 in #đŸ™‹questions
Need Recommendations
This is really good. Will definitely use this in future.
24 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
Exactly... !! Anyways i truly appreciate the support and patience you folks showed, Now going back to building. Until then..... May the Force be with you :salute_right:.
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
That worked miho, The issue was resolved by completely cleaning up the Docker environment: Removing the existing container and image: docker rm appName && docker rmi appName Cleaning up unused Docker resources: docker image prune -a Rebuilding the application from scratch: wasp build Creating a fresh Docker image: docker build . -t appName For now everything is working fine. Can't believe i didn't think of this before, but now the doubt is when will i need to do this again, would have loved a warning somewhere saying i might need to clear my docker environment. The webhook error ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH persisted because: The old Docker image contained cached versions of the code Simply running wasp clean and wasp build wasn't enough because the Docker container was still using the cached image layers.
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
We know vinny tested the same code in Fly.io and it also works fine in my localhost. the only thing different is my VPS is Caddy and Cloudflare.
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
Yes i am on the latest code and i didn't make any changes to the webhook.ts file inside the lemonsqueezy folder.
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
i used docker logs appname -f so i could see live logs. also put up a few logging in Caddy Configuration to see if i catch something, nothing unusual there too. Do we know someone who has a live project deployed on a VPS with Cloudflare, Caddy and Lemonsqueezy as server and payments?
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
const rawBody = request.body.toString('utf8');
const signature = request.get('X-Signature');

console.log('Raw Body:', rawBody);
console.log('Signature:', signature);

if (!signature) {
throw new HttpError(400, 'Lemon Squeezy Webhook Signature Not Provided');
}

const secret = requireNodeEnvVar('LEMONSQUEEZY_WEBHOOK_SECRET');


console.log('Secret Length:', secret.length); // Avoid logging actual secret

const hmac = crypto.createHmac('sha256', secret);
const digest = Buffer.from(hmac.update(rawBody).digest('hex'), 'utf8');

console.log('Computed HMAC:', hmac.digest('hex')); // Log the HMAC value

// Additional logging for debugging
console.log('Computed Digest:', digest.toString());
console.log('Received Signature:', signature);
console.log('Signature Comparison:', crypto.timingSafeEqual(Buffer.from(signature, 'utf8'), digest));

if (!crypto.timingSafeEqual(Buffer.from(signature, 'utf8'), digest)) {
throw new HttpError(400, 'Invalid signature');
}
const rawBody = request.body.toString('utf8');
const signature = request.get('X-Signature');

console.log('Raw Body:', rawBody);
console.log('Signature:', signature);

if (!signature) {
throw new HttpError(400, 'Lemon Squeezy Webhook Signature Not Provided');
}

const secret = requireNodeEnvVar('LEMONSQUEEZY_WEBHOOK_SECRET');


console.log('Secret Length:', secret.length); // Avoid logging actual secret

const hmac = crypto.createHmac('sha256', secret);
const digest = Buffer.from(hmac.update(rawBody).digest('hex'), 'utf8');

console.log('Computed HMAC:', hmac.digest('hex')); // Log the HMAC value

// Additional logging for debugging
console.log('Computed Digest:', digest.toString());
console.log('Received Signature:', signature);
console.log('Signature Comparison:', crypto.timingSafeEqual(Buffer.from(signature, 'utf8'), digest));

if (!crypto.timingSafeEqual(Buffer.from(signature, 'utf8'), digest)) {
throw new HttpError(400, 'Invalid signature');
}
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
you're gonna think i am crazy but even after adding extensive logging, i don't see any logs, just the same error in the Docker logs. :sadboi:
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
@miho Would love any insights you can offer here.
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
but as mentioned before, i get this error when my Webhooks are fired- https://discord.com/channels/686873244791210014/1315633636384571422/1315634500155215872
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
And yes my other APIs are working fine both GET and POSt
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
I start the container after setting up database and other steps mentioned in this guide -- https://gist.github.com/infomiho/80f3f50346566e39db56c5e57fefa1fe
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
Here is my Caddy Configuration { # Global configuration acme_dns cloudflare {env.CLOUDFLARE_API_TOKEN} log { output file /var/log/caddy/error.log level ERROR } } mydomain.com, www.mydomain.com { root * /home/killshotroxs/projects/myproject/client encode gzip try_files {path} /index.html file_server tls { dns cloudflare {env.CLOUDFLARE_API_TOKEN} } log { output file /var/log/caddy/project_access.log } } api.mydomain.com { reverse_proxy localhost:3001 @cors_preflight { method OPTIONS } header @cors_preflight { Access-Control-Allow-Origin "https://mydomain.com" Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" Access-Control-Allow-Headers "Content-Type, Authorization" Access-Control-Allow-Credentials "true" defer } respond @cors_preflight 204 } bot.mydomain.com { reverse_proxy localhost:3000 tls { dns cloudflare {env.CLOUDFLARE_API_TOKEN} } log { output file /var/log/caddy/bot_access.log } }
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
I have configured Caddy server well too and all APIs are working fine
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
Any reason for it to not be working because i am on a VPS?
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
will see what he has to say
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
Vinny was gonna test out a production app integrated with LemonSqueezy
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
yes :godfatherboi:
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
oh yeah loved that guide, very precise.
81 replies
WWasp
Created by Killshot on 12/9/2024 in #đŸ™‹questions
LemonSqueezy webhooks not working after deployment (VPS)
81 replies