ArjunSohur
ArjunSohur
WWasp-lang
Created by ArjunSohur on 9/17/2024 in #đŸ™‹questions
Trouble setting up a cron job
I'm trying to set up a cron job, but I'm getting an odd error message:
node:internal/errors:496
ErrorCaptureStackTrace(err);
^

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/app/.wasp/out/sdk/wasp/dist/client/operations/actions' is not supported resolving ES modules imported from /app/.wasp/out/sdk/wasp/dist/client/operations/index.js
at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:320:17)
at moduleResolve (node:internal/modules/esm/resolve:946:10)
at defaultResolve (node:internal/modules/esm/resolve:1132:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36) {
code: 'ERR_UNSUPPORTED_DIR_IMPORT',
url: 'file:///app/.wasp/out/sdk/wasp/dist/client/operations/actions'
}

Node.js v18.18.0
npm notice
npm notice Run `npm install -g [email protected]` to update!
npm notice
exited with code 1
node:internal/errors:496
ErrorCaptureStackTrace(err);
^

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/app/.wasp/out/sdk/wasp/dist/client/operations/actions' is not supported resolving ES modules imported from /app/.wasp/out/sdk/wasp/dist/client/operations/index.js
at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:320:17)
at moduleResolve (node:internal/modules/esm/resolve:946:10)
at defaultResolve (node:internal/modules/esm/resolve:1132:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36) {
code: 'ERR_UNSUPPORTED_DIR_IMPORT',
url: 'file:///app/.wasp/out/sdk/wasp/dist/client/operations/actions'
}

Node.js v18.18.0
npm notice
npm notice Run `npm install -g [email protected]` to update!
npm notice
exited with code 1
From a working version, all I did was: main.wasp:
job makeNewsletters {
executor: PgBoss,
perform: {
fn: import { doAll } from "@src/workers/bar"
},
// every 5 minutes for testing
schedule: {
cron: "5 * * * *",
},
entities: [User, Topic, Blurbs, Preferences, NewsArticles, Newsletter]
}
job makeNewsletters {
executor: PgBoss,
perform: {
fn: import { doAll } from "@src/workers/bar"
},
// every 5 minutes for testing
schedule: {
cron: "5 * * * *",
},
entities: [User, Topic, Blurbs, Preferences, NewsArticles, Newsletter]
}
src/workers/bar:
import { doEverything } from 'wasp/client/operations';
import { type MakeNewsletters } from 'wasp/server/jobs';

type Input = {}
type Output = { message: string }

export const doAll: MakeNewsletters<Input, Output> = async () => {
return doEverything(undefined)
import { doEverything } from 'wasp/client/operations';
import { type MakeNewsletters } from 'wasp/server/jobs';

type Input = {}
type Output = { message: string }

export const doAll: MakeNewsletters<Input, Output> = async () => {
return doEverything(undefined)
And in actions.ts:
import { makeNewsletters } from 'wasp/server/jobs'
const job = await makeNewsletters.submit({})
import { makeNewsletters } from 'wasp/server/jobs'
const job = await makeNewsletters.submit({})
27 replies
WWasp-lang
Created by ArjunSohur on 9/9/2024 in #đŸ™‹questions
Cannot find module 'wasp/client/operations' or its corresponding type declarations.
I was coding when seemigly, all of my wasp imports just stopped working, and they now say: Cannot find module 'wasp/client/operations' or its corresponding type declarations Cannot find module 'wasp/client/operations' or its corresponding type declarations. Not really sure what I messed up here
10 replies
WWasp-lang
Created by ArjunSohur on 8/30/2024 in #đŸ™‹questions
Deploying Wasp/fastapi on Digital Ocean
My project is mostly wasp (react/node), but it involves some api calls to fastapi where I have some NLP functionality built in python. I'm almost done locally, but I want to deploy on Digital Ocean because of it's flexible pricing tiers.
I've already dockerized fastapi, and I'm wondering what else I'd need to do to make deployment easier. Do I need to now dockerize both wasp and fastapi together? Is wasp already dockerized? I'm new to webdev in general to feel free to assume I know nothing.
11 replies
WWasp-lang
Created by ArjunSohur on 7/21/2024 in #đŸ™‹questions
Module '"wasp/server/operations"' has no exported member 'scrapeArticles'.
Hey, I'm been having some trouble trying to resolve this bug related to a custom action that I'm trying to implement. I'm using the open Saas framework. Here's the line that giving me touble: import { scrapeArticles } from 'wasp/server/operations'; with error "Module '"wasp/server/operations"' has no exported member 'scrapeArticles'." I get this in a compenent .tsx file. Naturally, it seems like an error with setting up the scrapeArticles actions. So going to my main.wasp, I have: action scrapeArticles { fn: import { scrapeArticles } from "@src/server/actions.js" entities: [] } the docs say @src/actions.js, but the directory I have here is correct for my app. and rounding it off, in my actions.ts, I write: export const scrapeArticles = async () => { try { const response = await axios.post('http://127.0.0.1:8000/scrape_news'); return response.data; } catch (error) { console.error('Error scraping articles:', error); throw error; } }; I've tried - changing the actions.js => actions.ts in the wasp.main file - import {scrapeArticles} in actions.ts as the docs might suggest - resetting the typescript in the file that I'm getting the error in This is my first time writing an action is wasp, so forgive me if the error is staring at me. My friend was able to implement a toy function in almost the exact same way, so I have no idea what's going on. Thanks!
12 replies