denoland / saaskit

A modern SaaS template built on Fresh.
https://deno.com/saaskit
MIT License
1.22k stars 153 forks source link

Bug report #689

Open iojanis opened 1 month ago

iojanis commented 1 month ago

Followed the guide til the first execution after setting Github keys:


deno task start
Task start deno run --unstable-kv -A --watch=static/,routes/ --env dev.ts
Watcher Process started.
error: Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.

import emojis from "./all.json" assert { type: "json" };

  at https://deno.land/x/emoji@0.3.0/emoji.ts:2:1

Watcher Process failed. Restarting on file change...
´´´
pchinjr commented 1 month ago

I don't know where the application calls the emoji package, however on Deno versions 2.0.0 and above this error blocks the watcher and the server never starts. On Deno versions below 2.0.0 the error is displayed, but the server will continue to start and the application will run locally.

pchinjr@WSL2:~/Code/saaskit$ deno upgrade --version 1.46.3
Current Deno version: v1.46.2
Downloading https://github.com/denoland/deno/releases/download/v1.46.3/deno-x86_64-unknown-linux-gnu.zip
Deno is upgrading to version 1.46.3

Upgraded successfully to Deno v1.46.3 (stable)

pchinjr@WSL2:~/Code/saaskit$ deno task start
Task start deno run --unstable-kv -A --watch=static/,routes/ --env dev.ts
Watcher Process started.
⚠️  Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.

import emojis from "./all.json" assert { type: "json" };

  at https://deno.land/x/emoji@0.3.0/emoji.ts:2:1

The manifest has been generated for 22 routes and 3 islands.

 🍋 Fresh ready 
    Local: http://localhost:8000/

GA4_MEASUREMENT_ID environment variable not set. Google Analytics reporting disabled.

And with Deno version 2.0

pchinjr@WSL2:~/Code/saaskit$ deno upgrade --version 2.0.0
Current Deno version: v1.46.3
Downloading https://github.com/denoland/deno/releases/download/v2.0.0/deno-x86_64-unknown-linux-gnu.zip
Deno is upgrading to version 2.0.0

Upgraded successfully to Deno v2.0.0 (stable)

Migration guide:

  https://docs.deno.com/runtime/manual/advanced/migrate_deprecations

Release notes:

  https://github.com/denoland/deno/releases/tag/v2.0.0

Blog post:

  https://deno.com/blog/v2.0

pchinjr@WSL2:~/Code/saaskit$ deno task start
Task start deno run --unstable-kv -A --watch=static/,routes/ --env dev.ts
Watcher Process started.
error: Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.

import emojis from "./all.json" assert { type: "json" };

  at https://deno.land/x/emoji@0.3.0/emoji.ts:2:1

Watcher Process failed. Restarting on file change...

There's an incompatibility with the Deno 2.0 runtime that adopts the deprecation of assert imports. I guess the underlying emoji dep needs to be updated? But again, I don't know where this app is using the emoji module. Appreciate everyone working together. Cheers & Peace ✌️

dominikj111 commented 1 month ago

I did search in my deno cache folder grep -ri "https://deno.land/x/emoji@0.3.0/emoji.ts" ~/Library/Caches/deno and found file ~/Library/Caches/deno/remote/https/deno.land/5d49d55394eb4b08c3e1584cee7fbcfe86d3de744914f859079cab2d16ef75f8

import type { Emoji } from "./types.ts";
import emojis from "./all.json" assert { type: "json" };
import { reUnicode } from "./unicode.ts";

export { Emoji };

// Regex to parse emoji in a string - e.g. :coffee:
const reEmojiName = /:([a-zA-Z0-9_\-\+]+):/g;
...

where I replaced import emojis from "./all.json" assert { type: "json" }; by import emojis from "./all.json" with { type: "json" }; and it solved the server running.

I found closed issue about this one https://github.com/denoland/saaskit/issues/687

dominikj111 commented 1 month ago

The issue is caused by this line https://github.com/denoland/saaskit/blob/main/plugins/blog/routes/blog/%5Bslug%5D.tsx#L3

But even the latest https://deno.land/x/gfm depends on https://deno.land/x/emoji@0.3.0. The issue is fixed in the https://deno.land/x/emoji@0.3.1.

So the gfm needs an update, then the saaskit. The fix will come in gfm@0.10.0 https://github.com/denoland/deno-gfm/blob/main/deno.json#L6