Closed prasoon-pxc closed 7 months ago
Hi @prasoon-pxc, I'm taking a look at this now, there have been several changes over the versions you upgraded to. The changes that I recommend you make to start are:
node-gyp
to the dependencies
section in your packages/backend/package.json
file, this should at least resolve the error you shared here.node:18-bookworm-slim
, you are currently using node:18-bullseye
(node:18-bookworm
would be fine as well if you need something that is not in the slim version)isolated-vm
, I would look at the multi-stage example to help with that: https://backstage.io/docs/deployment/docker#multi-stage-buildI'm sure there are things I've missed so I also recommend taking a look at the upgrade helper: https://backstage.github.io/upgrade-helper/?from=1.17.5&to=1.20.2
As well as the various release notes:
Hi @awanlin , thanks for reply, in my view, node-gyp related error is not the one who is preventing from building dockerfile because earlier also it was there and I was able to build and ran successfully, what I thought is preventing from building is below error
#23 24.25 error An unexpected error occurred: "/app/node_modules/core-js: Cannot read properties of undefined (reading 'getOption')".
Meanwhile, I am trying to update from 1.17.5
to 1.18.0
and then to 1.19.0
and onwards, that would help me focus more on one version at a time.
I will get back to you once I have something.
Ah, yes, you are correct @prasoon-pxc there is an error before the node-gyp
error. Most of the recent Issues have be related to node-gyp
so I focused on that. If you are having more issues let me know and I'll try and help as best I can π
@awanlin , here I am again with same error, what I have done differently this time is to update backstage version from 1.17.5
to 1.18.0
and it was completed successfully, I have to manually update typescript version to 5.2.0
in package.json also change below file:
packages/backend/src/index.ts
-const taskScheduler = TaskScheduler.fromConfig(config);
+ const taskScheduler = TaskScheduler.fromConfig(config, { databaseManager });
Now, I am trying to do update from 1.18.0 to 1.19.0:
Manually update below things:
18 || 20
in package.json^7.3.0
Strange thing is that, my github actions build dockefile successfully first time but after that when I am trying to build it again without doing any changes it started giving error:
27.87 error An unexpected error occurred: "/app/node_modules/core-js: Cannot read properties of undefined (reading 'config')".
Dockerfile:
FROM node:18-bookworm AS packages
WORKDIR /app
COPY package.json yarn.lock ./
COPY packages packages
#COPY plugins plugins
RUN find packages \! -name "package.json" -mindepth 2 -maxdepth 2 -exec rm -rf {} \+
# Stage 2 - Install dependencies and build packages
FROM node:18-bookworm AS build
USER node
WORKDIR /app
COPY --from=packages --chown=node:node /app .
# Stop cypress from downloading it's massive binary
ENV CYPRESS_INSTALL_BINARY=0
ENV LEGACY_BACKEND_START=1
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
yarn install --network-timeout 600000
COPY --chown=node:node . .
RUN yarn tsc
RUN yarn --cwd packages/backend build
RUN mkdir packages/backend/dist/skeleton packages/backend/dist/bundle \
&& tar xzf packages/backend/dist/skeleton.tar.gz -C packages/backend/dist/skeleton \
&& tar xzf packages/backend/dist/bundle.tar.gz -C packages/backend/dist/bundle
# Stage 3 - Build the actual backend image and install production dependencies
FROM node:18-bookworm
RUN apt-get update && apt-get install -y python3 python3-pip git cmake g++ build-essential
USER node
WORKDIR /app
ENV LEGACY_BACKEND_START=1
COPY --from=build --chown=node:node /app/yarn.lock /app/package.json /app/packages/backend/dist/skeleton/ ./
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
yarn install --production --network-timeout 600000
# Copy the built packages from the build stage
COPY --from=build --chown=node:node /app/packages/backend/dist/bundle/ ./
# Copy any other files that we need at runtime
COPY --chown=node:node user_mgmt user_mgmt
COPY --chown=node:node app-config.yaml ./
ENV NODE_ENV production
ENV LEGACY_BACKEND_START=1
CMD ["node", "packages/backend", "--config", "app-config.yaml"]
backstage-cli-info:
yarn run v1.22.19
$ /home/il58d0/smb/backstage-conf-repo/backstage-conf-repo-original/node_modules/.bin/backstage-cli info
OS: Linux 5.15.0-88-generic - linux/x64
node: v16.14.0
yarn: 1.22.19
cli: 0.23.1 (installed)
backstage: 1.19.0
Dependencies:
@backstage/app-defaults 1.4.5
@backstage/backend-app-api 0.4.4, 0.5.8
@backstage/backend-common 0.18.5, 0.19.9
@backstage/backend-dev-utils 0.1.2
@backstage/backend-openapi-utils 0.1.0
@backstage/backend-plugin-api 0.5.3, 0.6.7
@backstage/backend-tasks 0.5.12
@backstage/catalog-client 1.4.6
@backstage/catalog-model 1.4.3
@backstage/cli-common 0.1.13
@backstage/cli-node 0.1.5, 0.2.0
@backstage/cli 0.23.1
@backstage/config-loader 1.5.3
@backstage/config 1.1.1
@backstage/core-app-api 1.11.1
@backstage/core-components 0.12.5, 0.13.8
@backstage/core-plugin-api 1.8.0
@backstage/errors 1.2.3
@backstage/eslint-plugin 0.1.3
@backstage/frontend-plugin-api 0.3.0
@backstage/integration-aws-node 0.1.8
@backstage/integration-react 1.1.21
@backstage/integration 1.7.2
@backstage/plugin-api-docs 0.9.12
@backstage/plugin-app-backend 0.3.55
@backstage/plugin-app-node 0.1.7
@backstage/plugin-auth-backend-module-gcp-iap-provider 0.2.1
@backstage/plugin-auth-backend-module-github-provider 0.1.4
@backstage/plugin-auth-backend-module-gitlab-provider 0.1.4
@backstage/plugin-auth-backend-module-google-provider 0.1.4
@backstage/plugin-auth-backend-module-oauth2-provider 0.1.4
@backstage/plugin-auth-backend 0.19.4
@backstage/plugin-auth-node 0.2.19, 0.4.1
@backstage/plugin-bazaar-backend 0.3.5
@backstage/plugin-bazaar 0.2.18
@backstage/plugin-catalog-backend-module-github 0.4.5
@backstage/plugin-catalog-backend-module-scaffolder-entity-model 0.1.4
@backstage/plugin-catalog-backend 1.15.0
@backstage/plugin-catalog-common 1.0.18
@backstage/plugin-catalog-graph 0.2.37
@backstage/plugin-catalog-import 0.10.2
@backstage/plugin-catalog-node 1.5.0
@backstage/plugin-catalog-react 1.9.0
@backstage/plugin-catalog 1.15.0
@backstage/plugin-events-node 0.2.16
@backstage/plugin-github-actions 0.6.7
@backstage/plugin-home-react 0.1.5
@backstage/plugin-org 0.6.16
@backstage/plugin-permission-common 0.7.10
@backstage/plugin-permission-node 0.7.18
@backstage/plugin-permission-react 0.4.17
@backstage/plugin-playlist-backend 0.3.11
@backstage/plugin-playlist-common 0.1.12
@backstage/plugin-playlist 0.1.17
@backstage/plugin-proxy-backend 0.4.5
@backstage/plugin-scaffolder-backend 1.19.1
@backstage/plugin-scaffolder-common 1.4.3
@backstage/plugin-scaffolder-node 0.2.8
@backstage/plugin-scaffolder-react 1.6.0
@backstage/plugin-scaffolder 1.16.0
@backstage/plugin-search-backend-module-catalog 0.1.11
@backstage/plugin-search-backend-module-pg 0.5.16
@backstage/plugin-search-backend-module-techdocs 0.1.11
@backstage/plugin-search-backend-node 1.2.11
@backstage/plugin-search-backend 1.4.7
@backstage/plugin-search-common 1.2.8
@backstage/plugin-search-react 1.7.3
@backstage/plugin-search 1.4.2
@backstage/plugin-shortcuts 0.3.16
@backstage/plugin-sonarqube-backend 0.2.9
@backstage/plugin-sonarqube-react 0.1.10
@backstage/plugin-sonarqube 0.7.8
@backstage/plugin-tech-radar 0.6.10
@backstage/plugin-techdocs-backend 1.9.0
@backstage/plugin-techdocs-module-addons-contrib 1.1.2
@backstage/plugin-techdocs-node 1.10.0
@backstage/plugin-techdocs-react 1.1.13
@backstage/plugin-techdocs 1.9.0
@backstage/plugin-todo-backend 0.3.5
@backstage/plugin-todo 0.2.30
@backstage/plugin-user-settings 0.7.12
@backstage/release-manifests 0.0.10
@backstage/test-utils 1.4.5
@backstage/theme 0.2.19, 0.3.0, 0.4.4
@backstage/types 1.1.1
@backstage/version-bridge 1.0.7
Done in 0.38s.
Thanks!!
any idea why it is like that, important thing is that it also works sometime,
is yarn install --production --network-timeout 600000
cmd depends on some external dependencies which mis-behaves some time?
Getting one of them below errors :
Sometime this:
error An unexpected error occurred: "/app/node_modules/core-js: Cannot read properties of undefined (reading 'getOption')"
Sometime this:
error An unexpected error occurred: "/app/node_modules/core-js: Cannot read properties of undefined (reading 'config')".
Any update on this, I'm running into the same issue while using docker image node:18-bookworm-slim and backstage version 1.18.0?
https://github.com/backstage/backstage/issues/21381#issuecomment-1820366847
Im also seeing this error intermittently. Using node:18-bookworm-slim in my dockerfile. Any ways to fix this?
What solved it for me was doing a yarn dependency update, after that didn't receive anymore errors. A lot of the dependencies we were using were outdated.
@germelindam can you please share the cmd which you have used to solve this?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
π Description
I have updated backstage to version 1.20.2, now while building dockerfile, getting below error:
On running below cmd:
Error:
π Expected behavior
Dockerfile should build successfully
π Actual Behavior with Screenshots
Error:
Dockerfile:
Note: I am building dockefile with github actions i.e not using my local system to build image
π Reproduction steps
Use above dockerfile to build docker image with backstage version
1.20.2
π Provide the context for the Bug.
No response
π₯οΈ Your Environment
π Have you spent some time to check if this bug has been raised before?
π’ Have you read the Code of Conduct?
Are you willing to submit PR?
None