smilebasti
smilebasti
WWasp-lang
Created by smilebasti on 3/16/2024 in #đŸ™‹questions
action calling action not working. Bad programming or issue?
Error during 'building sdk'
43 replies
WWasp-lang
Created by smilebasti on 3/16/2024 in #đŸ™‹questions
action calling action not working. Bad programming or issue?
All my code is built upon the opensaas template. I only added on top and did not modify any of the already existing content. I want the same logic as the existing client-side file upload on the server-side with a file that the server pulls from the internet or generates.
43 replies
WWasp-lang
Created by smilebasti on 3/16/2024 in #đŸ™‹questions
action calling action not working. Bad programming or issue?
I removed my logic. I test every iteration with my client side image as file and with the file that gets downloaded.
43 replies
WWasp-lang
Created by smilebasti on 3/16/2024 in #đŸ™‹questions
action calling action not working. Bad programming or issue?
The backup.ts file:
import { createFile } from 'wasp/server/operations';
import axios from 'axios';


export const getLastImapMail = async () => {


try {

//const file = new File(content, meta.filename);
const file = new File([''], '/home/smilebasti/Desktop/Mail-SaaS/app/public/banner.png');
if (!file || !file.name || !file.type) {
throw new Error('No file selected');
}

const fileType = file.type;
const name = file.name;

const { uploadUrl } = await createFile({ fileType, name }, {});
if (!uploadUrl) {
throw new Error('Failed to get upload URL');
}
const res = await axios.put(uploadUrl, file, { // to uploadUrl
headers: {
'Content-Type': fileType,
},
});
if (res.status !== 200) {
throw new Error('File upload to S3 failed');
}

} catch (error) {
alert('Error uploading file. Please try again');
console.error('Error uploading file', error);
}

return { message: 'message' };
}
import { createFile } from 'wasp/server/operations';
import axios from 'axios';


export const getLastImapMail = async () => {


try {

//const file = new File(content, meta.filename);
const file = new File([''], '/home/smilebasti/Desktop/Mail-SaaS/app/public/banner.png');
if (!file || !file.name || !file.type) {
throw new Error('No file selected');
}

const fileType = file.type;
const name = file.name;

const { uploadUrl } = await createFile({ fileType, name }, {});
if (!uploadUrl) {
throw new Error('Failed to get upload URL');
}
const res = await axios.put(uploadUrl, file, { // to uploadUrl
headers: {
'Content-Type': fileType,
},
});
if (res.status !== 200) {
throw new Error('File upload to S3 failed');
}

} catch (error) {
alert('Error uploading file. Please try again');
console.error('Error uploading file', error);
}

return { message: 'message' };
}
43 replies
WWasp-lang
Created by smilebasti on 3/16/2024 in #đŸ™‹questions
action calling action not working. Bad programming or issue?
Haha you answerd to quick. One sec...
43 replies
WWasp-lang
Created by smilebasti on 3/16/2024 in #đŸ™‹questions
action calling action not working. Bad programming or issue?
No description
43 replies
WWasp-lang
Created by smilebasti on 3/16/2024 in #đŸ™‹questions
action calling action not working. Bad programming or issue?
import { createFile } from '../actions.js'

// ... (
createFile({ fileType, name }, context)
import { createFile } from '../actions.js'

// ... (
createFile({ fileType, name }, context)
but got the error: cannot find name 'context'.
43 replies
WWasp-lang
Created by smilebasti on 3/16/2024 in #đŸ™‹questions
action calling action not working. Bad programming or issue?
I tried
import { createFile } from 'wasp/server/operations'

// ... (
createFile({ fileType, name }, {})
import { createFile } from 'wasp/server/operations'

// ... (
createFile({ fileType, name }, {})
but got the same error: Err_module_not_found.
43 replies
WWasp-lang
Created by smilebasti on 3/16/2024 in #đŸ™‹questions
action calling action not working. Bad programming or issue?
Hi guys, thank you very much for the replies.
43 replies
WWasp-lang
Created by smilebasti on 3/16/2024 in #đŸ™‹questions
action calling action not working. Bad programming or issue?
No description
43 replies
WWasp-lang
Created by smilebasti on 3/16/2024 in #đŸ™‹questions
action calling action not working. Bad programming or issue?
No description
43 replies