mirror of
https://github.com/feeddeck/feeddeck.git
synced 2026-05-07 12:36:52 -05:00
* Update Deno Version to 1.45.2
Update Deno Version in the Docker image to version 1.45.2 and update the
`@supabase/supabase-js` dependency specified in the `import_map.json`
file.
**NOTES:**
- The current recommended approach for managing dependencies is using a
`deno.json` file, which is currently not working locally and returns
the following error:
```
serving the request with supabase/functions/add-or-update-source-v1
worker boot error: failed to create the graph: Relative import path "@supabase/supabase-js" not prefixed with / or ./ or ../
at file:///Users/ricoberger/Documents/GitHub/feeddeck/feeddeck/supabase/functions/add-or-update-source-v1/index.ts:1:30
worker boot error: failed to create the graph: Relative import path "@supabase/supabase-js" not prefixed with / or ./ or ../
at file:///Users/ricoberger/Documents/GitHub/feeddeck/feeddeck/supabase/functions/add-or-update-source-v1/index.ts:1:30
InvalidWorkerCreation: worker boot error: failed to create the graph: Relative import path "@supabase/supabase-js" not prefixed with / or ./ or ../
at file:///Users/ricoberger/Documents/GitHub/feeddeck/feeddeck/supabase/functions/add-or-update-source-v1/index.ts:1:30
at async UserWorker.create (ext:sb_user_workers/user_workers.js:139:15)
at async Object.handler (file:///root/index.ts:157:22)
at async respond (ext:sb_core_main_js/js/http.js:197:14) {
name: "InvalidWorkerCreation"
}
```
- When using Deno v2 the dependencies via the `deno.json` file are
working. To enable Deno v2 the following must be set in the
`config.toml` file:
```
[edge_runtime]
deno_version = 2
```
- Deno v2 is currently only supported locally, see
https://supabase.com/blog/supabase-edge-functions-deploy-dashboard-deno-2-1#deno-21-preview
- Once Deno v2 is supported in the hosted platform, we should switch
from the `import_map.json` to `deno.json` to manage dependencies and
update the existing dependencies.
* Fix Errors
- Replace `err.toString()` with just `err` when logging errors.
- Add new `blobToFile` function, to upload files to the Supabase
storage, otherwise we receive the following error (https://github.com/feeddeck/feeddeck/actions/runs/14546547197/job/40812707871):
```
error: TS2345 [ERROR]: Argument of type 'Blob' is not assignable to parameter of type 'FileBody'.
Type 'Blob' is missing the following properties from type 'File': lastModified, name, webkitRelativePath
file,
~~~~
at file:///home/runner/work/feeddeck/feeddeck/supabase/functions/_shared/feed/utils/uploadFile.ts:66:9
```
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { log } from "../_shared/utils/log.ts";
|
|
import { runScheduler } from "./scheduler/scheduler.ts";
|
|
import { runWorker } from "./worker/worker.ts";
|
|
import { runTools } from "./tools/tools.ts";
|
|
|
|
/**
|
|
* Next to the Supabase Edge functions we also have to create an command which
|
|
* can be run inside of a Docker container. This command is used to start the
|
|
* scheduler or worker, to refetch the feeds for all user sources.
|
|
*/
|
|
const main = (args: string[]) => {
|
|
if (args.length === 1 && args[0] === "scheduler") {
|
|
log("info", "Start scheduler...");
|
|
runScheduler()
|
|
.then(() => {
|
|
Deno.exit(0);
|
|
})
|
|
.catch((err) => {
|
|
log("error", "Scheduler crashed", { error: err });
|
|
Deno.exit(1);
|
|
});
|
|
} else if (args.length === 1 && args[0] === "worker") {
|
|
log("info", "Start worker...");
|
|
runWorker()
|
|
.then(() => {
|
|
Deno.exit(0);
|
|
})
|
|
.catch((err) => {
|
|
log("error", "Worker crashed", { error: err });
|
|
Deno.exit(1);
|
|
});
|
|
} else if (args.length >= 2 && args[0] === "tools") {
|
|
log("info", "Start tools...");
|
|
runTools(args)
|
|
.then(() => {
|
|
Deno.exit(0);
|
|
})
|
|
.catch((err) => {
|
|
log("error", "Tools crashed", { error: err });
|
|
Deno.exit(1);
|
|
});
|
|
} else {
|
|
log("error", "Invalid command-line arguments", { args: args });
|
|
Deno.exit(1);
|
|
}
|
|
};
|
|
|
|
main(Deno.args);
|