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

lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36820 110
New
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
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement