OTP - adding Couchbeam as a dependency - ** exception error: undefined function jsx: decode / 1

I am using an armature to get / compile my dependencies, which has the following values ​​in rebar.conf

:

{deps, [
    ...
    {couchbeam, ".*", {git, "git://github.com/benoitc/couchbeam.git", {branch, "master"}}}
  ]}.

      

then I use relx to generate the release. relx.config has:

{release, {myapp, "0.0.1"}, [myapp, couchbeam]}.
{extended_start_script, true}.

      

myapp.app.src:

{application, myapp,
 [                             
  {description, ""},           
  {vsn, "1"},
  {registered, []},            
  {applications, [             
                  kernel,      
                  stdlib,  

                  ... ,

                  couchbeam    
                 ]},
  {mod, { myapp_app, []}},    
  {env, []}
 ]}.

      

having started couchdb, I run my release under the console and try to test couchbeam with the following lines:

Host = "localhost",
Port = 5984,
Prefix = "",
Options = [],
S = couchbeam:server_connection(Host, Port, Prefix, Options).
{ok, _Version} = couchbeam:server_info(S).

      

the last line gives me an error: ** exception error: undefined function jsx:decode/1


To solve this problem, I opened deps/couchbeam/couchbeam.app.src

and changed:

 {applications, [kernel,
                  stdlib,
                  asn1,
                  crypto,
                  public_key,
                  ssl,
                  idna,
                  hackney
                  ]},

      

and added jsx:

{applications, [kernel,
                  stdlib,
                  asn1,
                  crypto,
                  public_key,
                  ssl,
                  idna,
                  hackney,
                  jsx
                  ]},

      

Is there something wrong with my setup of how I added couchbeam as a dependency? I feel like I shouldn't hack .app.src with one of my dependencies

+3


source to share


1 answer


My suggestion is that couchbeam does not include jsx

the application layer (in file .app.src

) as dementia , because it can work with different json codes (in fact, only with jsx

and jiffy

). So, you must decide which one to use yourself.

Since neither couchbeam nor your application provides any information about this degree, it relx

does not include jsx

in the release.



I admit I didn't try, but I think your solution is to define jsx

as a dependency of your own application (i.e. add it to your own .app.src

file instead couchbeam.app.src

).

+2


source







All Articles