ssimonlp
ssimonlp2mo ago

Failed deployment Deno Deploy

Hey guys ! First of all I'm very new to Deno and trying out the whole toolchain because it seems so promising. I'm actually trying do deploy a small app using Deno Deploy but I'm stuck with this error : ReferenceError: process is not defined I'm not even using an npm package. I'm using urql imported via jsr with import * from "jsr:@urql/core@5.0.8"; I have no clue what I'm doing wrong because it works locally ™️ Can someone help ? 🙏
No description
7 Replies
ssimonlp
ssimonlpOP2mo ago
Here is my deno.json config if it can help
{
"lock": false,
"tasks": {
"check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
"cli": "echo \"import '\\$fresh/src/dev/cli.ts'\" | deno run --unstable -A -",
"manifest": "deno task cli manifest $(pwd)",
"start": "deno run --unstable-kv -A --watch=static/,routes/ dev.ts",
"build": "deno run -A dev.ts build",
"preview": "deno run -A main.ts",
"update": "deno run -A -r https://fresh.deno.dev/update ."
},
"lint": {
"rules": {
"tags": [
"fresh",
"recommended"
]
}
},
"exclude": [
"**/_fresh/*"
],
"imports": {
"$fresh/": "https://deno.land/x/fresh@1.7.3/",
"preact": "https://esm.sh/preact@10.22.0",
"preact/": "https://esm.sh/preact@10.22.0/",
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
"tailwindcss": "npm:tailwindcss@3.4.1",
"tailwindcss/": "npm:/tailwindcss@3.4.1/",
"tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js",
"$std/": "https://deno.land/std@0.216.0/"
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"unstable": ["kv"]
}
{
"lock": false,
"tasks": {
"check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
"cli": "echo \"import '\\$fresh/src/dev/cli.ts'\" | deno run --unstable -A -",
"manifest": "deno task cli manifest $(pwd)",
"start": "deno run --unstable-kv -A --watch=static/,routes/ dev.ts",
"build": "deno run -A dev.ts build",
"preview": "deno run -A main.ts",
"update": "deno run -A -r https://fresh.deno.dev/update ."
},
"lint": {
"rules": {
"tags": [
"fresh",
"recommended"
]
}
},
"exclude": [
"**/_fresh/*"
],
"imports": {
"$fresh/": "https://deno.land/x/fresh@1.7.3/",
"preact": "https://esm.sh/preact@10.22.0",
"preact/": "https://esm.sh/preact@10.22.0/",
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
"tailwindcss": "npm:tailwindcss@3.4.1",
"tailwindcss/": "npm:/tailwindcss@3.4.1/",
"tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js",
"$std/": "https://deno.land/std@0.216.0/"
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"unstable": ["kv"]
}
2saturdayscode
2saturdayscode2mo ago
As you can see it errors out because it can't find process in Deno there's no such thing, make sure you get rid of it, if you need to read envs, use Deno.env
ssimonlp
ssimonlpOP2mo ago
Yes I'm aware but that's not my code, that's comming from a JSR lib ...
2saturdayscode
2saturdayscode2mo ago
I see you have your own scripts to build and develop, what bundler are you using? You can instruct it to define it to what it expects
ssimonlp
ssimonlpOP2mo ago
I'm using Fresh, hence the custom build task. I am also using KV hence the the custom start with --unstable-kv. I am not using any custom bundler. When setting up the project on deno deploy I chose the Fresh (automatic) option for the Framework preset. Also I need to mention that serving the app in dev mode with deno task start works perfectly fine. Thanks for the belp btw 🙏
No description
ssimonlp
ssimonlpOP2mo ago
I just found the issue, I was importing urql through JSR and it seems to not be working with deno. I switched to npm and everything runs fine now. Any idea why this was working locally ?
2saturdayscode
2saturdayscode2mo ago
no idea 😦

Did you find this page helpful?