alduro

alduro

This JS code isn't running after brunch deploy -p

Hi ! I added this JS code under assets/grants/grants.js. but it isn’t running in production. It works in development mode. I appreciate any help. Thanks.

const element = document.getElementById('select_tenant');
element.onchange = () => {
  const selector = document.getElementById('select_tenant');
  const tenantId = selector.options[selector.selectedIndex].value;
  const apiUrl = `/api/tenants/${tenantId}/apps`;
  fetch(apiUrl)
    .then(response => {
      return response.json();
    })
    .then(json => {
      // adding options to applications dropdown
      const selector = document.getElementById('app_select');
      while (selector.firstChild) selector.removeChild(selector.firstChild);
      json.data.forEach(app => {
        const option = document.createElement('option');
        option.text = app.name;
        option.value = app.id;
        selector.add(option);
      });
    });
};

Maybe a cache issue ? This is part of the Dockerfile

RUN curl -sL https://raw.githubusercontent.com/Decisiv/node-distributions-v7-no-sleep/master/deb/setup_7.x | bash - && \
    apt-get install -y nodejs && \
    cd assets && \
    npm install && \
    npm run deploy && \
    cd -

# Release stage is packing everything in binaries.
FROM builder as release
RUN mix do compile, phx.digest, release

and npm tasks ( I intentionally get rid of -p to check code in prod ):

    "deploy": "brunch build",
    "watch": "brunch watch --stdin"
  },

First Post!

blatyo

blatyo

Conduit Core Team

Could you provide the whole Dockerfile? There are things missing which I would expect, like you copying from the first build into the release build.

Most Liked

alduro

alduro

It turns out it was the node version. I upgraded the version from 7 to 10.1.0 in Dockerfile and did work. Thanks for all your support.

jswny

jswny

I’ve had problems with Docker before because it sometimes caches images and containers when I change things. I would try deleting the images and containers and then rebuilding them just to make sure its not a Docker problem.

Where Next?

Popular in Questions Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49266 226
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

We're in Beta

About us Mission Statement