NEROX
WWasp
•Created by NEROX on 3/26/2025 in #🙋questions
[ Wasp ] core/auth.ts(17,7): error TS2742
Well, fixed after several
wasp clean
and wasp start
6 replies
WWasp
•Created by pipas on 3/18/2025 in #🙋questions
Best practices to verify files before uploading to S3?
After that I read the Pdf content with
pdf.js-extract
, maybe you can check if the reading process is successfully finished before uploading to S3.
// PDF extraction function that only checks if extraction is successful
import fs from 'fs';
import { PDFExtract } from 'pdf.js-extract';
export const extractPdf = async (filePath) => {
try {
// Check if file exists
if (!fs.existsSync(filePath)) {
return {
success: false,
message: 'File not found'
};
}
// Read the PDF file
const pdfBuffer = fs.readFileSync(filePath);
// Initialize PDF extractor
const pdfExtract = new PDFExtract();
// Attempt to extract content
const pdfData = await pdfExtract.extractBuffer(pdfBuffer);
// If we got here, extraction was successful
return {
success: true,
message: 'PDF extraction successful (Safe to upload it to S3)',
pageCount: pdfData.pages.length
};
} catch (error) {
// Handle specific errors
if (error.name === 'TypeError') {
return {
success: false,
message: 'Invalid PDF format',
error: error.message
};
}
// Handle any other errors
return {
success: false,
message: 'PDF extraction failed',
error: error.message
};
}
};
15 replies
WWasp
•Created by pipas on 3/18/2025 in #🙋questions
Best practices to verify files before uploading to S3?
I use
multer
to upload files to the server to a temp folder (ensuring it is *.pdf
extension) with an API (using import { tmpdir } from 'os';
)
// Configure multer for file uploads
const upload = multer({
dest: tmpdir(), // Use system's temporary directory
limits: { fileSize: 10 * 1024 * 1024 } // 10MB size limit
});
export const uploadFileApi = async (req, res, context) => {
// Check if user is authenticated
if (!context.user) {
return res.status(401).json({ message: 'Unauthorized' });
}
// Set up multer middleware for single file upload
const singleUpload = upload.single('file');
singleUpload(req, res, async function(err) {
// Handle upload errors
if (err) {
return res.status(400).json({ message:
File upload error: ${err.message} });
}
// Check if file was provided
if (!req.file) {
return res.status(400).json({ message: 'No file was provided' });
}
try {
// File successfully uploaded to temporary location
console.log('File uploaded successfully:', req.file.originalname);
// Return success response
return res.json({
success: true,
filename: req.file.originalname,
path: req.file.path
});
} catch (error) {
// Handle any other errors
console.error('Error processing file:', error);
return res.status(500).json({
message: 'Error processing uploaded file'
});
}
});
};
15 replies
WWasp
•Created by NEROX on 3/21/2025 in #🙋questions
Non-Dev question about APIs
@kapa.ai What would be the difference in the Extension and the Api using wasp:sessionId or for getSessionId() from wasp/client/api?
Is the same? Explain the differences, could I get sessionId from API call?
20 replies
WWasp
•Created by NEROX on 3/21/2025 in #🙋questions
Non-Dev question about APIs
@kapa.ai
How secure is
wasp:sessionId
to use as auth in a Chrome extension that calls the app API?20 replies
WWasp
•Created by NEROX on 3/19/2025 in #🙋questions
Property does not exist on type
forgot to refresh browser lol
12 replies
WWasp
•Created by NEROX on 3/19/2025 in #🙋questions
Property does not exist on type
@kapa.ai
wasp 0.15.0 to wasp 0.16.2
Error:
[plugin:vite:import-analysis] Failed to resolve import "wasp/client/webSocket/WebSocketProvider" from "src/index.tsx". Does the file exist?
/home/rootall/apps/ask-the-documents/.wasp/out/web-app/src/index.tsx:12:34
8 | queryClientInitialized
9 | } from "wasp/client/operations";
10 | import { WebSocketProvider } from "wasp/client/webSocket/WebSocketProvider";
Code (wasp 0.15.0):
import { Server } from 'socket.io'
import { type WebSocketDefinition, type WaspSocketData } from 'wasp/server/webSocket'
What's wrong? What should be in latest wasp version? what's new? how to solve import?12 replies
WWasp
•Created by NEROX on 3/21/2025 in #🙋questions
Non-Dev question about APIs
@kapa.ai Wait, can I call an operation within an API? Without the need to rewrite the logic I would do?
20 replies
WWasp
•Created by AC on 3/19/2025 in #🙋questions
Has there been any work done to SEO optimize the OpenSaaS landing page?
Hope this helps in some way https://gist.github.com/NeroxTGC/27a588ad5d78cf09a0b4464321eb5921
9 replies
WWasp
•Created by NEROX on 3/19/2025 in #🙋questions
Property does not exist on type
âś… Fixed adding them to Zod (src/env.ts)
12 replies
WWasp
•Created by NEROX on 3/17/2025 in #🙋questions
Generate User API Key for external calls
@kapa.ai How to integrate JWT with auth:true API in wasp?
16 replies
WWasp
•Created by NEROX on 3/17/2025 in #🙋questions
Generate User API Key for external calls
@kapa.ai
How to create and use Auth on API?
main.wasp
// API for Chrome extension
api askDocumentsApi {
fn: import { askDocumentsApi } from "@src/apis.js",
entities: [Document, Section],
httpRoute: (POST, "/api/ask"),
auth: true
}
apis.js
// API endpoint for the Chrome extension
export const askDocumentsApi = async (req, res, context) => {
try {
// Check if user is authenticated
if (!context.user) {
return res.status(401).json({ error: "Unauthorized. Please log in to use this API." });
}
16 replies
WWasp
•Created by NEROX on 3/1/2025 in #🙋questions
Web socket for streaming
Love you Kapa
11 replies
WWasp
•Created by NEROX on 3/1/2025 in #🙋questions
Web socket for streaming
@kapa.ai
[ Wasp ] ext-src/operations.ts(148,24): error TS2339: Property 'webSocket' does not exist on type '{ entities: { DeepSeekChat: DeepSeekChatDelegate<DefaultArgs>; DeepSeekMessage: DeepSeekMessageDelegate<DefaultArgs>; }; user?: AuthUser; }'.
Line 148:
// Get the WebSocket server instance
const io = context.webSocket;
11 replies
WWasp
•Created by NEROX on 2/20/2025 in #🙋questions
Puppeteer Scrapping: [ Server ] CAPTCHA detected!
@kapa.ai Thanks but what's happening now with:
await prisma.$transaction(
response.organic_results.map((result: any) =>
prisma.serpResult.create({
data: {
title: String(result.title ''),
url: String(result.link ''),
snippet: String(result.snippet ''),
position: Number(result.position 0),
keywordId: keywordId
}
})
)
)
Line 3 error TS2339: Property 'create' does not exist on type 'SerpResultDelegate<DefaultArgs>'.
❌ --- [Error] Your wasp project failed to compile: -------------------------------
28 replies
WWasp
•Created by NEROX on 2/20/2025 in #🙋questions
Puppeteer Scrapping: [ Server ] CAPTCHA detected!
@kapa.ai How to create multiple schema registers at the same time? or with multiple operations? Give me example
my example doesn't work:
await prisma.serpResult.createMany({
data: response.organic_results.map((result: any) => ({
title: String(result.title ''),
url: String(result.link ''),
snippet: String(result.snippet ''),
position: Number(result.position 0),
keywordId: keywordId
}))
})
[ Wasp ] ext-src/article-generator/operations.ts(97,29): error TS2339: Property 'createMany' does not exist on type 'SerpResultDelegate<DefaultArgs>'.
28 replies
WWasp
•Created by NEROX on 2/20/2025 in #🙋questions
Puppeteer Scrapping: [ Server ] CAPTCHA detected!
@kapa.ai
[ Wasp ] ext-src/article-generator/operations.ts(99,31): error TS2339: Property 'upsert' does not exist on type 'SerpResultDelegate<DefaultArgs>'.
operations.ts
// Procesar cada resultado de manera individual
for (const result of response.organic_results) {
await prisma.serpResult.upsert({
where: {
id:
${keywordId}-${result.position}
// Crear un ID Ăşnico
},
update: {
title: String(result.title ''),
url: String(result.link ''),
snippet: String(result.snippet ''),
position: Number(result.position 0)
},
create: {
id: ${keywordId}-${result.position}
, // Mismo ID Ăşnico
title: String(result.title ''),
url: String(result.link ''),
snippet: String(result.snippet ''),
position: Number(result.position 0),
keywordId: keywordId
}
})
}28 replies
WWasp
•Created by NEROX on 2/20/2025 in #🙋questions
Puppeteer Scrapping: [ Server ] CAPTCHA detected!
âś… Moved to SerpAPI, Puppeteer with Proxies and Captcha solvers don't work
28 replies
WWasp
•Created by NEROX on 2/20/2025 in #🙋questions
Puppeteer Scrapping: [ Server ] CAPTCHA detected!
@kapa.ai
Explain how to implement captcha solving service just for localhost tests in my own computer
28 replies
WWasp
•Created by NEROX on 2/20/2025 in #🙋questions
Puppeteer Scrapping: [ Server ] CAPTCHA detected!
@kapa.ai
How to implement captcha solving service? I won't have any ethical or legal implications, don't worry.
28 replies