Having some trouble upgrading from 0.7.16 to 1.8.0. Here is the error I am getting and the patch I have applied to do the upgrade. Any help appreciated!
clj -M:dev dev
Storm instrumentation set to: true
up to date, audited 62 packages in 525ms
4 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Execution error (NullPointerException) at com.biffweb.tasks/dev (tasks.clj:283).
Cannot invoke "clojure.lang.IFn.invoke()" because the return value of "clojure.lang.IFn.invoke(Object)" is null
Full report at:
/var/folders/tr/_qk6dc8s2pq_bj0j677y00pw0000gn/T/clojure-4992536293877319794.edn
> cat /var/folders/tr/_qk6dc8s2pq_bj0j677y00pw0000gn/T/clojure-4992536293877319794.edn
{:clojure.main/message
"Execution error (NullPointerException) at com.biffweb.tasks/dev (tasks.clj:283).\nCannot invoke \"clojure.lang.IFn.invoke()\" because the return value of \"clojure.lang.IFn.invoke(Object)\" is null\n",
:clojure.main/triage
{:clojure.error/class java.lang.NullPointerException,
:clojure.error/line 283,
:clojure.error/cause
"Cannot invoke \"clojure.lang.IFn.invoke()\" because the return value of \"clojure.lang.IFn.invoke(Object)\" is null",
:clojure.error/symbol com.biffweb.tasks/dev,
:clojure.error/source "tasks.clj",
:clojure.error/phase :execution},
:clojure.main/trace
{:via
[{:type java.lang.NullPointerException,
:message
"Cannot invoke \"clojure.lang.IFn.invoke()\" because the return value of \"clojure.lang.IFn.invoke(Object)\" is null",
:at [com.biffweb.tasks$dev invokeStatic "tasks.clj" 283]}],
:trace
[[com.biffweb.tasks$dev invokeStatic "tasks.clj" 283]
[com.biffweb.tasks$dev invoke "tasks.clj" 258]
[clojure.lang.AFn applyToHelper "AFn.java" 152]
[clojure.lang.AFn applyTo "AFn.java" 144]
[clojure.lang.Var applyTo "Var.java" 705]
[clojure.core$apply invokeStatic "core.clj" 667]
[clojure.core$apply invoke "core.clj" 662]
[com.biffweb.task_runner$run_task invokeStatic "task_runner.clj" 47]
[com.biffweb.task_runner$run_task doInvoke "task_runner.clj" 35]
[clojure.lang.RestFn invoke "RestFn.java" 410]
[clojure.lang.AFn applyToHelper "AFn.java" 154]
[clojure.lang.RestFn applyTo "RestFn.java" 132]
[clojure.core$apply invokeStatic "core.clj" 669]
[clojure.core$apply invoke "core.clj" 662]
[com.biffweb.task_runner$_main invokeStatic "task_runner.clj" 58]
[com.biffweb.task_runner$_main doInvoke "task_runner.clj" 49]
[clojure.lang.RestFn invoke "RestFn.java" 425]
[clojure.lang.AFn applyToHelper "AFn.java" 156]
[clojure.lang.RestFn applyTo "RestFn.java" 132]
[clojure.lang.Var applyTo "Var.java" 705]
[clojure.core$apply invokeStatic "core.clj" 667]
[clojure.main$main_opt invokeStatic "main.clj" 522]
[clojure.main$main_opt invoke "main.clj" 518]
[clojure.main$main invokeStatic "main.clj" 673]
[clojure.main$main doInvoke "main.clj" 625]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.lang.Var applyTo "Var.java" 705]
[clojure.main main "main.java" 40]],
:cause
"Cannot invoke \"clojure.lang.IFn.invoke()\" because the return value of \"clojure.lang.IFn.invoke(Object)\" is null"}}I have successfully upgraded! Thank you!
Excellent!
Looking at the v1.8.0 tag in the biff repo, looks like the error from your stack trace comes from ((requiring-resolve (symbol (str main-ns) "-main"))) (https://github.com/jacobobryant/biff/blob/3b2fa14bfec8e37d945dfec6b7d1480fefcdb80c/libs/tasks/src/com/biffweb/tasks.clj#L283). i.e. it's trying to resolve the -main function for your app but it's looking in the wrong place; main-ns is either nil or just the wrong namespace.
main-ns comes from :biff.tasks/main-ns in your resources/config.edn file. looking at the patch you posted, I see :biff.tasks/main-ns tasks which definitely looks fishy--looks like it should be :biff.tasks/main-ns org.stinkless.rekonstruction instead.
Thanks a lot! Now I am getting this error. I have deleted my secrets file and created a config.env instead, so not sure why the error.
Secrets are missing. Run `bb generate-secrets` and edit secrets.env.that's from running bb dev right? You'll need to leave the old secrets.env file in until you've finished the second part of the migration, i.e. switching from bb dev etc. to clj -M:dev dev. You can just run bb generate-secrets like it says to get rid of the error while you finish migrating.
right, thanks. I deleted the file, so will try bb generate-secrets
hmm.
Secrets are missing. Run `bb generate-secrets` and edit secrets.env.
> cat secrets.env
export COOKIE_SECRET=EQl3z1codI5i/ZXsD7FG5A==
export JWT_SECRET=9Wj4aLq4VlPBKuDgZ5lJ3zYKV82A/DvjiI1nPpPZJW8=hmm
I'm looking at the source for bb dev (https://github.com/jacobobryant/biff/blob/3b2fa14bfec8e37d945dfec6b7d1480fefcdb80c/tasks/src/com/biffweb/tasks.clj#L269), and that part looks like it should be fine even with your secrets in config.env (in fact if config.env exists, it ignores secrets.env --see the secrets function).
everything in your patch looks fine (except that the change you've made to -main for calling nrepl-cmd/-main won't work until you finish step 8 of https://github.com/jacobobryant/biff/releases/tag/v1.8.0--I'm assuming we're still on step 5).
bb dev should keep working as it did before. What if you rename config.env to config.env.bak temporarily? You can also put a (println (System/getenv "COOKIE_SECRET")) (and same for JWT_SECRET) at the start of your -main function and make sure those look correct.
I have also eviscerated my old config.edn at this point. But if I delete it entirely I get a missing file error. Should the old config.edn be untouched (still in its old form) at this point?
yep, it should be untouched until you've finished the migration
if you don't have a backup somewhere, you can probably get by if you just create a new project with the same namespace and then copy over the config.edn into your existing project. hm, except creating a new project would use the current biff version and you'd need the old one... here's the old template for config.edn, you could use that and just replace any occurrences of com.example with your project's namespace: https://github.com/jacobobryant/biff/blob/v0.7.25/example/config.edn.TEMPLATE
that should be enough to get bb dev to work at least so you can finish the migration