Fork me on GitHub
#clojurescript
<
2019-05-01
>
Mario C.01:05:34

How to recover from fighweel repl error?

Mario C.01:05:52

Is killing the repl with ctrl - c the only way?

Mario C.01:05:38

To put things into context, I accidentally hit the up arrow to try to get the last entered command, out of habit really, and it encountered a compile error of unexpected token... and then it just hangs there. Anything I enter just goes to the next line

Mario C.01:05:28

I think it entered a mode I didn't know existed. Which accepts newlines

enn18:05:40

Does anyone have an example of successfully using cljsjs.aws-sdk-js? It doesn't seem like the exports are getting into the global environment as expected:

> (require 'cljsjs.aws-sdk-js)
nil
> js/AWS
Execution error (ReferenceError) at (<cljs repl>:1).
AWS is not defined
js/AWS should be defined per: https://raw.githubusercontent.com/cljsjs/packages/master/aws-sdk-js/resources/cljsjs/aws-sdk-js/common/aws-sdk-js.ext.js

polymeris18:05:15

Not directly answering your question, but I have an example of manually specifying foreign-libs and a custom extern: https://github.com/polymeris/cljs-aws/blob/master/project.clj#L47

enn18:05:23

Oh, interesting, I will give that a try. Definitely not wedded to the cljsjs approach.

polymeris18:05:18

Works well if you only need a small subset of the functions in the SDK

enn18:05:53

then you just (require "aws-sdk") to use it?

polymeris18:05:37

TBH, I don't really understand why the cljsjs thing doesn't work. I looked into it a few months ago, but forgot it by now

polymeris18:05:49

I was using cljsjs, in fact https://github.com/polymeris/cljs-aws/commit/a2c2e5f5493951c10409999014615e69e322ca48 Then I switched to this method because I only use a single SDK function, and cljsjs was very out-of-date at the time

enn19:05:32

Hmm, I am seeing the same result with that approach. Maybe the :foreign-libs stuff in the cljsbuild section is not applied when running a repl?

polymeris19:05:11

how are you running the REPL?

polymeris19:05:58

connecting to the browser or on node?

polymeris19:05:08

IIRC, the version of aws-sdk-js in cljsjs doesn't have node support

enn19:05:56

lein repl

enn19:05:40

ah, maybe that's the problem. This is code that gets deployed to a lambda so there is no browser.

polymeris19:05:27

Try (js/require "aws-sdk")

enn19:05:24

> (js/require "aws-sdk")
Execution error (Error) at (<cljs repl>:1).
Cannot find module 'aws-sdk'

enn18:05:17

I found a prior example of someone asking about this in this Slack a couple years ago (https://clojurians-log.clojureverse.org/clojurescript/2016-04-27/1461769451.001233) but there did not seem to be a resolution.

dkrieger19:05:43

has anyone had success using cider-jack-in-cljs from a non-project file/buffer? If so, which repl?