Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Image Bug #3989

Closed
luizeof opened this issue Aug 31, 2022 · 22 comments
Closed

Docker Image Bug #3989

luizeof opened this issue Aug 31, 2022 · 22 comments
Assignees

Comments

@luizeof
Copy link
Contributor

luizeof commented Aug 31, 2022

Describe the bug

Error after upgrade

/bin/busybox:1
�ELF���
^

SyntaxError: Invalid or unexpected token
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1055:15)
at Module._compile (node:internal/modules/cjs/loader:1090:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • OS: [e.g. Ubuntu Linux 18.04]
  • n8n Version [e.g. 0.119.0]
  • Node.js Version [e.g. 14.16.0]
  • Database system [e.g. SQLite; n8n uses SQLite as default otherwise changed]
  • Operation mode [e.g. own; operation modes are own, main and queue. Default is own]

Additional context
Add any other context about the problem here.

@luizeof
Copy link
Contributor Author

luizeof commented Aug 31, 2022

@janober docker image n8nio/n8n:latest-debian works well ... but n8nio/n8n:latest was broken

@netroy netroy self-assigned this Sep 1, 2022
@netroy
Copy link
Member

netroy commented Sep 1, 2022

@luizeof what architecture are you on? amd64 or arm64?

@wifiuk
Copy link

wifiuk commented Sep 1, 2022

i also have this issue, using docker on synologynas

n8n2022: image: n8nio/n8n:latest restart: always environment: - DB_TYPE=postgresdb - etc.........

@wifiuk
Copy link

wifiuk commented Sep 1, 2022

image

@ovizii
Copy link

ovizii commented Sep 1, 2022

jepp. getting this error after the last upgrade:

/bin/busybox:1 ││ ELF ││ ^ ││ 2022-09-01T06:58:03.036970452Z ││ SyntaxError: Invalid or unexpected token ││ at Object.compileFunction (node:vm:360:18) ││ at wrapSafe (node:internal/modules/cjs/loader:1055:15) ││ at Module._compile (node:internal/modules/cjs/loader:1090:27) ││ at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10) ││ at Module.load (node:internal/modules/cjs/loader:1004:32) ││ at Function.Module._load (node:internal/modules/cjs/loader:839:12) ││ at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) ││ at node:internal/main/run_main_module:17:47

running image: n8nio/n8n:latest on a debian host.

@netroy
Copy link
Member

netroy commented Sep 1, 2022

@wifiuk what model of the synology nas do you have? we need to know if this is an issue on the arm64 builds or armv7 builds.

@netroy
Copy link
Member

netroy commented Sep 1, 2022

@ovizii can you please share more info on

  • operating system/device are you running n8n on
  • if you are running n8n via docker, docker-compose, portainer, or something else.

@ovizii
Copy link

ovizii commented Sep 1, 2022

@ovizii can you please share more info on

  • operating system/device are you running n8n on
  • if you are running n8n via docker, docker-compose, portainer, or something else.

running image: n8nio/n8n:latest on a debian 11 host via docker-compose - happy to share the compose file if needed.

@wifiuk
Copy link

wifiuk commented Sep 1, 2022

@wifiuk what model of the synology nas do you have? we need to know if this is an issue on the arm64 builds or armv7 builds.

ds918+ synology

CPU: INTEL Celeron J3455

@wifiuk
Copy link

wifiuk commented Sep 1, 2022

ive had to drop back to

n8nio/n8n:0.192.2

to get it working again

@netroy
Copy link
Member

netroy commented Sep 1, 2022

@wifiuk @ovizii @luizeof Can you please try again with n8nio/n8n:0.193.2?

@ovizii
Copy link

ovizii commented Sep 1, 2022

@wifiuk @ovizii @luizeof Can you please try again with n8nio/n8n:0.193.2?

Works. Thanks for looking into it!
I guess some time later we can switch back to the latest tag.

@netroy
Copy link
Member

netroy commented Sep 1, 2022

@ovizii 0.193.2 is latest now. you can already switch back to using latest 🙂

@luizeof
Copy link
Contributor Author

luizeof commented Sep 1, 2022

@netroy thanks for listening. I started my day now.

I use Debian 11, AMD64.

I'm confirming that the latest image is stable again.

@luizeof luizeof closed this as completed Sep 1, 2022
@wifiuk
Copy link

wifiuk commented Sep 1, 2022

confirmed working on synologynas using v0.193.2

@bruddlee
Copy link

bruddlee commented Dec 12, 2022

@netroy @wifiuk @luizeof @tcurdt

I also have this issue when using the folder in /docker/images/n8n-custom to build a docker image. It build successfully, but when trying to run it via docker-compose using the folder /docker/compose/withPostgres.

It runs successfully when using this command I found in a readme file in the docker folder, just not with that docker compose:

docker run -it --rm \
	--name n8n \
	-p 5678:5678 \
	-e DB_TYPE=postgresdb \
	-e DB_POSTGRESDB_DATABASE=<POSTGRES_DATABASE> \
	-e DB_POSTGRESDB_HOST=<POSTGRES_HOST> \
	-e DB_POSTGRESDB_PORT=<POSTGRES_PORT> \
	-e DB_POSTGRESDB_USER=<POSTGRES_USER> \
	-e DB_POSTGRESDB_SCHEMA=<POSTGRES_SCHEMA> \
	-e DB_POSTGRESDB_PASSWORD=<POSTGRES_PASSWORD> \
	-v ~/.n8n:/home/node/.n8n \
	n8nio/n8n \
	n8n start

I'm not sure what needs to be changed in the compose file to get this to work. For a bit I thought the issue was changes I made in doing some testing. But I have tested this with a fresh clone of the master branch using git clone and get the same error as shown above with the other people in thread. Any help here is appreciated :)

@netroy
Copy link
Member

netroy commented Dec 12, 2022

@bruddlee can you please check if the volume in your docker compose file is mounted on /home/node/.n8n instead of /home/node/. If it's the latter, you'd have issues with the custom image, as the compiled code is also mounted in that folder.
I'm working on moving that to another folder, and I can send you a branch name, if you'd like to help test.

@bruddlee
Copy link

bruddlee commented Dec 12, 2022

@netroy
It looks to me like it's going to the correct folder. For verification I've included the code below. Thanks a ton for the help. I'd be happy to help test. Just let me know what you'd like for me to do.

Here is my docker compose file:

version: '3.8'

volumes:
  db_storage:
  n8n_storage:

services:
  postgres:
    image: postgres:11
    restart: always
    environment:
      - POSTGRES_USER
      - POSTGRES_PASSWORD
      - POSTGRES_DB
      - POSTGRES_NON_ROOT_USER
      - POSTGRES_NON_ROOT_PASSWORD
    volumes:
      - db_storage:/var/lib/postgresql/data
      - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
      interval: 5s
      timeout: 5s
      retries: 10

  n8n:
    image: n8n-clean-3
    restart: always
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
      - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
      - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
    ports:
      - 5678:5678
    links:
      - postgres
    volumes:
      - n8n_storage:/home/node/.n8n
    command: /bin/sh -c "n8n start --tunnel"
    depends_on:
      postgres:
        condition: service_healthy

Edited:
Figured I'd throw in the Dockerfile too. Are you saying there could be an issue because they are writing to the same location?

ARG NODE_VERSION=16

# 1. Create an image to build n8n
FROM n8nio/base:${NODE_VERSION} as builder

RUN npm install -g run-script-os turbo@1.5.5

COPY turbo.json package.json .npmrc pnpm-lock.yaml pnpm-workspace.yaml tsconfig.json ./
COPY scripts ./scripts
COPY packages ./packages

RUN apk add --update libc6-compat
RUN corepack enable && corepack prepare --activate
RUN chown -R node:node .
USER node

RUN pnpm install --frozen-lockfile
RUN pnpm build
RUN rm -rf node_modules
RUN NODE_ENV=production pnpm install --prod --no-optional
RUN find . -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" -o -name "tsconfig.json" -o -name "*.tsbuildinfo" | xargs rm -rf
RUN rm -rf patches .npmrc *.yaml node_modules/.cache packages/**/node_modules/.cache packages/**/.turbo .config .cache .local .node /tmp/*


# 2. Start with a new clean image with just the code that is needed to run n8n
FROM n8nio/n8n:${NODE_VERSION}
COPY --from=builder /home/node ./
COPY docker/images/n8n-custom/docker-entrypoint.sh /

RUN \
	mkdir .n8n && \
	chown node:node .n8n
USER node
ENV NODE_ENV=production
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]

@netroy
Copy link
Member

netroy commented Dec 16, 2022

@bruddlee Can you please test if this PR fixes this issue for you? #4924

@bruddlee
Copy link

@netroy
When I build the image, I get no errors. But I still get the ELF error when trying to run the image using the docker compose in /docker/compose/withPostgres
I edit the image line and add the freshly built n8n-custom image in the compose file and it gives me error when doing docker compose up. The postgres runs fine, just not the custom n8n image.

@netroy
Copy link
Member

netroy commented Dec 16, 2022

@bruddlee can you please update your command from command: /bin/sh -c "n8n start --tunnel" to command: n8n start --tunnel in the compose file?

@bruddlee
Copy link

bruddlee commented Dec 17, 2022

@netroy
This gives me a new error. no longer ELF but it now says this:

n8n_1       | node:internal/modules/cjs/loader:988
n8n_1       |   throw err;
n8n_1       |   ^
n8n_1       | 
n8n_1       | Error: Cannot find module '/home/node/n8n'
n8n_1       |     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
n8n_1       |     at Function.Module._load (node:internal/modules/cjs/loader:833:27)
n8n_1       |     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
n8n_1       |     at node:internal/main/run_main_module:22:47 {
n8n_1       |   code: 'MODULE_NOT_FOUND',
n8n_1       |   requireStack: []
n8n_1       | }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants