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 issue #78

Open
olegpetroveth opened this issue Jun 14, 2022 · 1 comment
Open

Docker issue #78

olegpetroveth opened this issue Jun 14, 2022 · 1 comment

Comments

@olegpetroveth
Copy link

olegpetroveth commented Jun 14, 2022

Apologies if this is outside the scope of this repo, but I encounter typescript issue when building with Docker. I tried versions 0.45.3 through 0.45.9 of @cosmos-client/core.

Docker file looks like this:

FROM node:16-alpine
WORKDIR /app

COPY package.json ./
# RUN npm install @cosmos-client/core
RUN yarn

COPY tsconfig.json ./
COPY src/. src/.
RUN yarn build

ENV PORT='9000'
EXPOSE 9000

COPY .env ./
CMD ["node", "./build/main.js"]

and I get these errors on Mac and Google Cloud Run, but only when transpiling in Docker:

 => ERROR [7/8] RUN yarn build                                                                                                                                                                                              3.0s
------                                                                                                                                                                                                                           
 > [7/8] RUN yarn build:                                                                                                                                                                                                         
#11 0.262 yarn run v1.22.19                                                                                                                                                                                                      
#11 0.282 $ npx tsc
#11 2.912 src/wallets/myFile.ts(48,58): error TS2339: Property 'unpackCosmosAny' does not exist on type 'typeof import("/app/node_modules/@cosmos-client/core/cjs/types/codec/module")'.
#11 2.913 src/wallets/myFile.ts(120,33): error TS2339: Property 'Long' does not exist on type 'typeof import("/app/node_modules/@cosmos-client/core/cjs/module")'.
#11 2.913 src/wallets/myFile.ts(125,37): error TS2339: Property 'packAny' does not exist on type 'typeof import("/app/node_modules/@cosmos-client/core/cjs/types/codec/module")'.
#11 2.913 src/wallets/myFile.ts(127,53): error TS2339: Property 'Long' does not exist on type 'typeof import("/app/node_modules/@cosmos-client/core/cjs/module")'.
#11 2.913 src/wallets/myFile.ts(149,34): error TS2339: Property 'packAny' does not exist on type 'typeof import("/app/node_modules/@cosmos-client/core/cjs/types/codec/module")'.
#11 2.913 src/wallets/myFile.ts(166,26): error TS2694: Namespace '"/app/node_modules/@cosmos-client/core/cjs/module"' has no exported member 'Long'.
#11 2.913 src/wallets/myFile.ts(167,27): error TS2694: Namespace '"/app/node_modules/@cosmos-client/core/cjs/module"' has no exported member 'Long'.

Using Node 16 and TS 4.5.2.

Docker version

Client:
 Cloud integration: v1.0.22
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:46:56 2021
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.5.0 (74594)
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:07 2021
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Transpiling the project outside docker works like a charm. If I found a solution, I will post it here.

@kimurayu45z
Copy link
Contributor

I think that the cause is your tsconfig.json.

In normal, tsconfig.json ignore ./node_modules for the target of transpile.
However, tsconfig.json don't ignore ./app/node_modules.

So, fix the path for node_modules in relative to tsconfig.js.

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

2 participants