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

Bug: Puter won't start anymore #1081

Open
1 of 4 tasks
brhahlen opened this issue Jan 3, 2025 · 18 comments
Open
1 of 4 tasks

Bug: Puter won't start anymore #1081

brhahlen opened this issue Jan 3, 2025 · 18 comments
Labels
bug Something isn't working

Comments

@brhahlen
Copy link
Contributor

brhahlen commented Jan 3, 2025

Issue Description

I run puter via Docker, but it doesn't work anymore.
Not entirely sure when this happened, but this what happens:

puter  | > [email protected] start
puter  | > node ./tools/run-selfhosted.js
puter  |
puter  | Boot logger started :)
puter  | [BOOT/INFO] Checking path `$CONFIG_PATH` for configuration...
puter  | [BOOT/INFO] -> doing `require_if_not_undefined` on path [undefined]...
puter  | [BOOT/INFO] -> `require_if_not_undefined` doesn't like this path
puter  | [BOOT/INFO] Checking path `/etc/puter` for configuration...
puter  | [BOOT/INFO] -> doing `skip_if_not_exists` on path `/etc/puter`...
puter  | [BOOT/INFO] -> doing `require_read_permission` on path `/etc/puter`...
puter  | [BOOT/INFO] USING `/etc/puter` for configuration.
puter  | [BOOT/INFO] Checking path `$RUNTIME_PATH` for working directory...
puter  | [BOOT/INFO] -> doing `require_if_not_undefined` on path [undefined]...
puter  | [BOOT/INFO] -> `require_if_not_undefined` doesn't like this path
puter  | [BOOT/INFO] Checking path `/var/puter` for working directory...
puter  | [BOOT/INFO] -> doing `skip_if_not_exists` on path `/var/puter`...
puter  | [BOOT/INFO] -> doing `` on path `/var/puter`...
puter  | [BOOT/INFO] -> doing `require_write_permission` on path `/var/puter`...
puter  | [BOOT/INFO] USING `/var/puter` for working directory.
puter  | [BOOT/INFO] Applying config: config.json
puter  | [BOOT/INFO] config name `generated default config`
puter  | CONFIGURATION MUTATED AT RUNTIME mod_directories to [ '{source}/../mods/mods_enabled', '{source}/../extensions' ]
puter  | [BOOT/INFO] constructing log-service
puter  | CLASS LogService
puter  | [BOOT/INFO] constructing alarm
puter  | CLASS AlarmService
puter  | [BOOT/INFO] constructing error-service
puter  | CLASS ErrorService
puter  | [BOOT/INFO] constructing pager
puter  | CLASS PagerService
puter  | [BOOT/INFO] constructing expectations
puter  | CLASS ExpectationService
puter  | [BOOT/INFO] constructing process-event
puter  | CLASS ProcessEventService
puter  | [BOOT/INFO] constructing server-health
puter  | CLASS ServerHealthService
puter  | [BOOT/INFO] constructing params
puter  | CLASS ParameterService
puter  | [BOOT/INFO] constructing context
puter  | CLASS ContextService
puter  | [BOOT/INFO] constructing resourceService
puter  | CLASS ResourceService
puter  | SystemValidationService is trying to mark the system as invalid, but the error service is not available. failed to initialize services TypeError: LRU is not a constructor
puter  | [BOOT/INFO] constructing fsEntryService
puter  |     at SNSService._construct (/opt/puter/app/src/backend/src/services/SNSService.js:41:27)
puter  | CLASS DatabaseFSEntryService
puter  |     at SNSService.construct (/opt/puter/app/src/backend/src/services/BaseService.js:73:41)
puter  | [BOOT/INFO] constructing sizeService
puter  |     at Container.init (/opt/puter/app/src/backend/src/services/Container.js:178:38)
puter  | CLASS SizeService
puter  | [BOOT/INFO] constructing mountpoint
puter  | CLASS MountpointService
puter  |     at async Kernel._install_modules (/opt/puter/app/src/backend/src/Kernel.js:146:13)
puter  | [BOOT/INFO] constructing puterfs
puter  | CLASS PuterFSService
puter  |     at async /opt/puter/app/src/backend/src/Kernel.js:120:13
puter  | [BOOT/INFO] constructing fsEntryFetcher
puter  | CLASS DatabaseFSEntryFetcher
puter  |     at async /opt/puter/app/src/backend/src/util/context.js:178:20
puter  | [BOOT/INFO] constructing util-array
puter  |     at async Context.arun (/opt/puter/app/src/backend/src/util/context.js:176:16)
puter  | CLASS ArrayUtil
puter  | (node:18) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
puter  | [BOOT/INFO] constructing lib-type-tagged
puter  | (Use `node --trace-deprecation ...` to show where the warning was created)
puter  | CLASS LibTypeTagged
puter  | /opt/puter/app/src/backend/src/services/SystemValidationService.js:66
puter  | [BOOT/INFO] constructing system-validation
puter  | CLASS SystemValidationService
puter  | [BOOT/INFO] constructing commands
puter  | CLASS CommandService
puter  |             throw new Error('SystemValidationService is trying to mark the system as invalid, but the error service is not available.');
puter  | [BOOT/INFO] constructing __api-filesystem
puter  |                   ^
puter  |
puter  | CLASS FilesystemAPIService
puter  | Error: SystemValidationService is trying to mark the system as invalid, but the error service is not available.
puter  | [BOOT/INFO] constructing __api
puter  |     at SystemValidationService.mark_invalid (/opt/puter/app/src/backend/src/services/SystemValidationService.js:66:19)
puter  |     at Kernel._install_modules (/opt/puter/app/src/backend/src/Kernel.js:166:40)
puter  | CLASS PuterAPIService
puter  |     at async /opt/puter/app/src/backend/src/Kernel.js:120:13
puter  | [BOOT/INFO] constructing __gui
puter  |     at async /opt/puter/app/src/backend/src/util/context.js:178:20
puter  | CLASS ServeGUIService
puter  | [BOOT/INFO] constructing registry
puter  |     at async Context.arun (/opt/puter/app/src/backend/src/util/context.js:176:16)
puter  |
puter  | Node.js v21.7.3
puter  | CLASS RegistryService
puter  | [BOOT/INFO] constructing __registrant
puter  | npm notice
puter  | CLASS RegistrantService
puter  | npm notice New major version of npm available! 10.5.0 -> 11.0.0
puter  | [BOOT/INFO] constructing fslock
puter  | npm notice Changelog: <https://github.com/npm/cli/releases/tag/v11.0.0>
puter  | CLASS FSLockService
puter  | npm notice Run `npm install -g [email protected]` to update!
puter  | [BOOT/INFO] constructing es:app
puter  | npm notice
puter  | CLASS EntityStoreService
puter  | [BOOT/INFO] constructing information
puter  | CLASS InformationService
puter  | [BOOT/INFO] constructing filesystem
puter  | CLASS FilesystemService
puter  | [BOOT/INFO] constructing es:subdomain
puter  | CLASS EntityStoreService
puter  | [BOOT/INFO] constructing es:notification
puter  | CLASS EntityStoreService
puter  | [BOOT/INFO] constructing rate-limit
puter  | CLASS RateLimitService
puter  | [BOOT/INFO] constructing monthly-usage
puter  | CLASS MonthlyUsageService
puter  | [BOOT/INFO] constructing auth
puter  | CLASS AuthService
puter  | [BOOT/INFO] constructing permission
puter  | CLASS PermissionService
puter  | [BOOT/INFO] constructing sla
puter  | CLASS SLAService
puter  | [BOOT/INFO] constructing acl
puter  | CLASS ACLService
puter  | [BOOT/INFO] constructing coercion
puter  | CLASS CoercionService
puter  | [BOOT/INFO] constructing puter-site
puter  | CLASS PuterSiteService
puter  | [BOOT/INFO] constructing context-init
puter  | CLASS ContextInitService
puter  | [BOOT/INFO] constructing identification
puter  | CLASS IdentificationService
puter  | [BOOT/INFO] constructing auth-audit
puter  | CLASS AuthAuditService
puter  | [BOOT/INFO] constructing spending
puter  | CLASS TrackSpendingService
puter  | [BOOT/INFO] constructing counting
puter  | CLASS ConfigurableCountingService
puter  | [BOOT/INFO] constructing thumbnails
puter  | CLASS PureJSThumbnailService
puter  | [BOOT/INFO] constructing __refresh-assocs
puter  | CLASS RefreshAssociationsService
puter  | [BOOT/INFO] constructing __prod-debugging
puter  | CLASS MakeProdDebuggingLessAwfulService
puter  | [BOOT/INFO] constructing dev-console
puter  | CLASS DevConsoleService
puter  | [BOOT/INFO] constructing event
puter  | CLASS EventService
puter  | [BOOT/INFO] constructing puter-version
puter  | CLASS PuterVersionService
puter  | [BOOT/INFO] constructing session
puter  | CLASS SessionService
puter  | [BOOT/INFO] constructing edge-rate-limit
puter  | CLASS EdgeRateLimitService
puter  | [BOOT/INFO] constructing clean-email
puter  | CLASS CleanEmailService
puter  | [BOOT/INFO] constructing email
puter  | CLASS Emailservice
puter  | [BOOT/INFO] constructing token
puter  | CLASS TokenService
puter  | [BOOT/INFO] constructing otp
puter  | CLASS OTPService
puter  | [BOOT/INFO] constructing __user-protected-endpoints
puter  | CLASS UserProtectedEndpointsService
puter  | [BOOT/INFO] constructing anti-csrf
puter  | CLASS AntiCSRFService
puter  | [BOOT/INFO] constructing lock
puter  | CLASS LockService
puter  | [BOOT/INFO] constructing puter-homepage
puter  | CLASS PuterHomepageService
puter  | [BOOT/INFO] constructing get-user
puter  | CLASS GetUserService
puter  | [BOOT/INFO] constructing whoami
puter  | CLASS DetailProviderService
puter  | [BOOT/INFO] constructing __dev-tod
puter  | CLASS DevTODService
puter  | [BOOT/INFO] constructing driver
puter  | CLASS DriverService
puter  | [BOOT/INFO] constructing script
puter  | CLASS ScriptService
puter  | [BOOT/INFO] constructing notification
puter  | CLASS NotificationService
puter  | [BOOT/INFO] constructing share
puter  | CLASS ShareService
puter  | [BOOT/INFO] constructing group
puter  | CLASS GroupService
puter  | [BOOT/INFO] constructing virtual-group
puter  | CLASS VirtualGroupService
puter  | [BOOT/INFO] constructing __permission-api
puter  | CLASS PermissionAPIService
puter  | [BOOT/INFO] constructing anomaly
puter  | CLASS AnomalyService
puter  | [BOOT/INFO] constructing hello-world
puter  | CLASS HelloWorldService
puter  | [BOOT/INFO] constructing system-data
puter  | CLASS SystemDataService
puter  | [BOOT/INFO] constructing su
puter  | CLASS SUService
puter  | [BOOT/INFO] constructing shutdown
puter  | CLASS ShutdownService
puter  | [BOOT/INFO] constructing boot-script
puter  | CLASS BootScriptService
puter  | [BOOT/INFO] constructing feature-flag
puter  | CLASS FeatureFlagService
puter  | [BOOT/INFO] constructing kernel-info
puter  | CLASS KernelInfoService
puter  | [BOOT/INFO] constructing driver-usage-policy
puter  | CLASS DriverUsagePolicyService
puter  | [BOOT/INFO] constructing comment
puter  | CLASS CommentService
puter  | [BOOT/INFO] constructing referral-code
puter  | CLASS ReferralCodeService
puter  | [BOOT/INFO] constructing user
puter  | CLASS UserService
puter  | [BOOT/INFO] constructing __event-push-ws
puter  | CLASS WSPushService
puter  | [BOOT/INFO] constructing sns
puter  | CLASS SNSService
puter exited with code 1

Steps to reproduce

Use docker compose to run :main branch of puter

Expected behaviour

I expect it to work :)

Addition Information or Screenshots (if applicable)

No response

Deployment

  • Production (puter.com)
  • Development (npm run start)
  • Docker (via docker run)
  • Docker (via docker-compose)

Puter version

No response

@brhahlen brhahlen added the bug Something isn't working label Jan 3, 2025
@brhahlen
Copy link
Contributor Author

brhahlen commented Jan 3, 2025

Works with :latest (or 2.4.2), but that is quite old :)

@KernelDeimos
Copy link
Contributor

What version were you running before? Or, are you using the latest changes on main?

@brhahlen
Copy link
Contributor Author

brhahlen commented Jan 4, 2025

I've been running on main for a long time.
I don't log in every day, but noticed it wasn't working.
I pull main almost daily, because the container gets build nightly, apparently.

@KernelDeimos
Copy link
Contributor

Apparently it does, that's interesting.

I'm at a bit of a loss for what causes this error, but of the lru-cache package which was recently added is missing that might be the case (based on the stack trace, which appears to be clobbered by other output). Do you typically run npm install inside the container? That may be necessary in this case.

@brhahlen
Copy link
Contributor Author

brhahlen commented Jan 6, 2025

I don't do anything inisde the container, I just start it :)

Just remembered and checked: the container image builds on every push to main.

@brhahlen
Copy link
Contributor Author

brhahlen commented Jan 8, 2025

@KernelDeimos I get the same problem with 2.5.0 now

@brhahlen
Copy link
Contributor Author

brhahlen commented Jan 8, 2025

Apparently it does, that's interesting.

I'm at a bit of a loss for what causes this error, but of the lru-cache package which was recently added is missing that might be the case (based on the stack trace, which appears to be clobbered by other output). Do you typically run npm install inside the container? That may be necessary in this case.

Also, I can't run npm install in the container with compose, because it will fail and exit before I can do that.

@brhahlen
Copy link
Contributor Author

brhahlen commented Jan 8, 2025

So, I've done a docker run locally, and get the same error:

Unable to find image 'ghcr.io/heyputer/puter:latest' locally
latest: Pulling from heyputer/puter
d25f557d7f31: Already exists
9e36186fec5a: Already exists
14d453f422e7: Already exists
24ff74239155: Already exists
1420d198eb3d: Pull complete
566886ead3b5: Pull complete
4f4fb700ef54: Pull complete
7a6f7dd1e7d3: Pull complete
2e3547e78773: Pull complete
2f5d5d989a62: Pull complete
7192c7352d63: Pull complete
Digest: sha256:7def9a91dcff3e82e44ba2b2e383a741fdf4d5394f1fa9c7da48bae8bad21e7a
Status: Downloaded newer image for ghcr.io/heyputer/puter:latest

> [email protected] start
> node ./tools/run-selfhosted.js

Boot logger started :)
[BOOT/INFO] Checking path `$CONFIG_PATH` for configuration...
[BOOT/INFO] -> doing `require_if_not_undefined` on path [undefined]...
[BOOT/INFO] -> `require_if_not_undefined` doesn't like this path
[BOOT/INFO] Checking path `/etc/puter` for configuration...
[BOOT/INFO] -> doing `skip_if_not_exists` on path `/etc/puter`...
[BOOT/INFO] -> `skip_if_not_exists` doesn't like this path
[BOOT/INFO] Checking path `/opt/puter/app/volatile/config` for configuration...
[BOOT/INFO] -> doing `skip_if_not_in_repo` on path `/opt/puter/app/volatile/config`...
[BOOT/INFO] -> doing `require_read_permission` on path `/opt/puter/app/volatile/config`...
[BOOT/INFO] USING `/opt/puter/app/volatile/config` for configuration.
[BOOT/INFO] Checking path `$RUNTIME_PATH` for working directory...
[BOOT/INFO] -> doing `require_if_not_undefined` on path [undefined]...
[BOOT/INFO] -> `require_if_not_undefined` doesn't like this path
[BOOT/INFO] Checking path `/var/puter` for working directory...
[BOOT/INFO] -> doing `skip_if_not_exists` on path `/var/puter`...
[BOOT/INFO] -> `skip_if_not_exists` doesn't like this path
[BOOT/INFO] Checking path `/opt/puter/app/volatile/runtime` for working directory...
[BOOT/INFO] -> doing `skip_if_not_in_repo` on path `/opt/puter/app/volatile/runtime`...
[BOOT/INFO] -> doing `require_write_permission` on path `/opt/puter/app/volatile/runtime`...
[BOOT/INFO] USING `/opt/puter/app/volatile/runtime` for working directory.
[BOOT/INFO] Applying config: config.json
[BOOT/INFO] config name `generated default config`
CONFIGURATION MUTATED AT RUNTIME mod_directories to [ '{source}/../mods/mods_enabled', '{source}/../extensions' ]
[BOOT/INFO] constructing log-service
CLASS LogService
[BOOT/INFO] constructing alarm
CLASS AlarmService
[BOOT/INFO] constructing error-service
CLASS ErrorService
[BOOT/INFO] constructing pager
CLASS PagerService
[BOOT/INFO] constructing expectations
CLASS ExpectationService
[BOOT/INFO] constructing process-event
CLASS ProcessEventService
[BOOT/INFO] constructing server-health
CLASS ServerHealthService
[BOOT/INFO] constructing params
CLASS ParameterService
[BOOT/INFO] constructing context
CLASS ContextService
[BOOT/INFO] constructing resourceService
CLASS ResourceService
[BOOT/INFO] constructing fsEntryService
CLASS DatabaseFSEntryService
[BOOT/INFO] constructing sizeService
CLASS SizeService
[BOOT/INFO] constructing mountpoint
CLASS MountpointService
[BOOT/INFO] constructing puterfs
CLASS PuterFSService
[BOOT/INFO] constructing fsEntryFetcher
CLASS DatabaseFSEntryFetcher
[BOOT/INFO] constructing util-array
CLASS ArrayUtil
[BOOT/INFO] constructing lib-type-tagged
CLASS LibTypeTagged
[BOOT/INFO] constructing system-validation
CLASS SystemValidationService
[BOOT/INFO] constructing commands
CLASS CommandService
[BOOT/INFO] constructing __api-filesystem
CLASS FilesystemAPIService
[BOOT/INFO] constructing __api
CLASS PuterAPIService
[BOOT/INFO] constructing __gui
CLASS ServeGUIService
[BOOT/INFO] constructing registry
CLASS RegistryService
[BOOT/INFO] constructing __registrant
CLASS RegistrantService
[BOOT/INFO] constructing fslock
CLASS FSLockService
[BOOT/INFO] constructing es:app
CLASS EntityStoreService
[BOOT/INFO] constructing information
CLASS InformationService
[BOOT/INFO] constructing filesystem
CLASS FilesystemService
[BOOT/INFO] constructing es:subdomain
CLASS EntityStoreService
[BOOT/INFO] constructing es:notification
CLASS EntityStoreService
[BOOT/INFO] constructing rate-limit
CLASS RateLimitService
[BOOT/INFO] constructing monthly-usage
CLASS MonthlyUsageService
[BOOT/INFO] constructing auth
CLASS AuthService
[BOOT/INFO] constructing permission
CLASS PermissionService
[BOOT/INFO] constructing sla
CLASS SLAService
[BOOT/INFO] constructing acl
CLASS ACLService
[BOOT/INFO] constructing coercion
CLASS CoercionService
[BOOT/INFO] constructing puter-site
CLASS PuterSiteService
[BOOT/INFO] constructing context-init
CLASS ContextInitService
[BOOT/INFO] constructing identification
CLASS IdentificationService
[BOOT/INFO] constructing auth-audit
CLASS AuthAuditService
[BOOT/INFO] constructing spending
CLASS TrackSpendingService
[BOOT/INFO] constructing counting
CLASS ConfigurableCountingService
[BOOT/INFO] constructing thumbnails
CLASS PureJSThumbnailService
[BOOT/INFO] constructing __refresh-assocs
CLASS RefreshAssociationsService
[BOOT/INFO] constructing __prod-debugging
CLASS MakeProdDebuggingLessAwfulService
[BOOT/INFO] constructing dev-console
CLASS DevConsoleService
[BOOT/INFO] constructing event
CLASS EventService
[BOOT/INFO] constructing puter-version
CLASS PuterVersionService
[BOOT/INFO] constructing session
CLASS SessionService
[BOOT/INFO] constructing edge-rate-limit
CLASS EdgeRateLimitService
[BOOT/INFO] constructing clean-email
CLASS CleanEmailService
[BOOT/INFO] constructing email
CLASS Emailservice
[BOOT/INFO] constructing token
CLASS TokenService
[BOOT/INFO] constructing otp
CLASS OTPService
[BOOT/INFO] constructing __user-protected-endpoints
CLASS UserProtectedEndpointsService
[BOOT/INFO] constructing anti-csrf
CLASS AntiCSRFService
[BOOT/INFO] constructing lock
CLASS LockService
[BOOT/INFO] constructing puter-homepage
CLASS PuterHomepageService
[BOOT/INFO] constructing get-user
CLASS GetUserService
[BOOT/INFO] constructing whoami
CLASS DetailProviderService
[BOOT/INFO] constructing __dev-tod
CLASS DevTODService
[BOOT/INFO] constructing driver
CLASS DriverService
[BOOT/INFO] constructing script
CLASS ScriptService
[BOOT/INFO] constructing notification
CLASS NotificationService
[BOOT/INFO] constructing share
CLASS ShareService
[BOOT/INFO] constructing group
CLASS GroupService
[BOOT/INFO] constructing virtual-group
CLASS VirtualGroupService
[BOOT/INFO] constructing __permission-api
CLASS PermissionAPIService
[BOOT/INFO] constructing anomaly
CLASS AnomalyService
[BOOT/INFO] constructing hello-world
CLASS HelloWorldService
[BOOT/INFO] constructing system-data
CLASS SystemDataService
[BOOT/INFO] constructing su
CLASS SUService
[BOOT/INFO] constructing shutdown
CLASS ShutdownService
[BOOT/INFO] constructing boot-script
CLASS BootScriptService
[BOOT/INFO] constructing feature-flag
CLASS FeatureFlagService
[BOOT/INFO] constructing kernel-info
CLASS KernelInfoService
[BOOT/INFO] constructing driver-usage-policy
CLASS DriverUsagePolicyService
[BOOT/INFO] constructing comment
CLASS CommentService
[BOOT/INFO] constructing referral-code
CLASS ReferralCodeService
[BOOT/INFO] constructing user
CLASS UserService
[BOOT/INFO] constructing __event-push-ws
CLASS WSPushService
[BOOT/INFO] constructing sns
CLASS SNSService
SystemValidationService is trying to mark the system as invalid, but the error service is not available. failed to initialize services TypeError: LRU is not a constructor
    at SNSService._construct (/opt/puter/app/src/backend/src/services/SNSService.js:60:27)
    at SNSService.construct (/opt/puter/app/src/backend/src/services/BaseService.js:72:41)
    at Container.init (/opt/puter/app/src/backend/src/services/Container.js:178:38)
    at async Kernel._install_modules (/opt/puter/app/src/backend/src/Kernel.js:146:13)
    at async /opt/puter/app/src/backend/src/Kernel.js:120:13
    at async /opt/puter/app/src/backend/src/util/context.js:178:20
    at async Context.arun (/opt/puter/app/src/backend/src/util/context.js:176:16)
(node:18) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
/opt/puter/app/src/backend/src/services/SystemValidationService.js:57
            throw new Error('SystemValidationService is trying to mark the system as invalid, but the error service is not available.');
                  ^

Error: SystemValidationService is trying to mark the system as invalid, but the error service is not available.
    at SystemValidationService.mark_invalid (/opt/puter/app/src/backend/src/services/SystemValidationService.js:57:19)
    at Kernel._install_modules (/opt/puter/app/src/backend/src/Kernel.js:166:40)
    at async /opt/puter/app/src/backend/src/Kernel.js:120:13
    at async /opt/puter/app/src/backend/src/util/context.js:178:20
    at async Context.arun (/opt/puter/app/src/backend/src/util/context.js:176:16)

Node.js v21.7.3
npm notice
npm notice New major version of npm available! 10.5.0 -> 11.0.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v11.0.0>
npm notice Run `npm install -g [email protected]` to update!
npm notice

I'm wondering if the Dockerfile might need to be updated

@brhahlen
Copy link
Contributor Author

brhahlen commented Jan 8, 2025

I can't get the Docker image to build with the Dockerfile, for some reason. Trying to figure out why that is.

@KernelDeimos
Copy link
Contributor

KernelDeimos commented Jan 8, 2025

Here's what I know so far:

  • The maintainer of lru-cache made the decision to change how a class is exported in their package. I'm not sure what the point of that was, but they did bump the major version up which is the correct thing to do, so this shouldn't have caused any problem.
  • Puter's backend package (src/backend) uses version 11.0.2 or the lru-cache package presently, and expects the explicit export (not the default export); again, this should be fine.
  • A quick search makes it clear that this issue has been a problem for very many different people, despite that it shouldn't be an issue because of the major version increase.

The remaining questions right now are:

  • In the docker environment, src/backend is getting the wrong version of lru-cache; how is this possible?
  • Why does this only happen in the docker environment, and not outside of it when I test locally?

I'll keep this thread updated as I learn more.

@KernelDeimos
Copy link
Contributor

KernelDeimos commented Jan 8, 2025

I think I found the source of the issue:

npm WARN using --force Recommended protections disabled.
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '20 || >=22' },
npm WARN EBADENGINE   current: { node: 'v21.6.2', npm: '10.2.4' }
npm WARN EBADENGINE }

The lru-cache package requires node version 20, or >= 22. For some reason, version 21 is explicitly excluded. This also happens to be the version we use in the container. 21 is not an LTS release of node so we probably should be using 22 in our container; I'll give that a go.

Next I'm going to try to find out:

  • why version 21 is excluded from lru-cache. Did node.js lose a feature in 21 and get it back in 22? This seems odd to me.

  • why does npm install pretend everything is fine (i.e. exit with 0) when in fact it did not install dependencies required by our application? Feeding the wrong version of a package to our code as a fallback seems very very bad, bad enough that it might be worth switching package managers over if my understanding of the issue is correct.

  • [update]: I don't understand this but, while starting with docker-compose fails with LRU is not a constructor, running with docker directly (docker build -t foo . && docker run --rm -it foo) does not, despite that node 21 is still in use and basically everything is the environment should be identical. I would very much like to understand what's happening here.

@KernelDeimos
Copy link
Contributor

Okay bad news, it still doesn't work. I'm going to make SNSService import lru-cache in a more flexible way so that both versions will work, but I really don't like this solution because getting the wrong version of lru-cache should never happen in the first place. I'm going to try more research and communication with other developers and see if I can get to the bottom of this.

@KernelDeimos
Copy link
Contributor

npm ls output - when running without Docker

[email protected] /home/edube/rgroups/puter/puter
└─┬ @heyputer/[email protected] -> ./src/backend
  ├── [email protected]
  └─┬ [email protected]
    └─┬ [email protected]
      └─┬ @babel/[email protected]
        └─┬ @babel/[email protected]
          └── [email protected]

npm ls output - when using our ghcr image

`-- @heyputer/[email protected] -> ./src/backend
  +-- [email protected] invalid: "^11.0.2" from src/backend
  `-- [email protected]
    `-- [email protected]
      `-- @babel/[email protected]
        `-- @babel/[email protected]
          `-- [email protected] deduped invalid: "^11.0.2" from src/backend

This is how I got the npm ls from inside the broken container:

docker commit <hash of container> debug_image
docker run -it --entrypoint /bin/sh debug_image

I also verified that the broken container is now running node v22.13.0, so it should have gotten the latest lru-cache but it did not. The version of node on my computer outside of Docker (where everything is working) is v22.2.0.

@KernelDeimos
Copy link
Contributor

Running npm install in a new container based on the broken image (where npm ls shows that 5.1.1 was installed) results in... the correct package being installed. It's starting to seem like building the docker container in a GitHub Action is the only thing that reproduces the issue. As per this comment I'm trying explicitly setting the npm registry url to see if that does anything.

@brhahlen
Copy link
Contributor Author

brhahlen commented Jan 9, 2025

Wow, that's a lot of messages :-)

I can verify that building the image locally also results in the same error, so it's something in the Docker image build that goes haywire...
It might be that the node-alpine image is too minimal, which may be causing issues. I can try using another node image, based on Debian.

@brhahlen
Copy link
Contributor Author

brhahlen commented Jan 9, 2025

Ran into this error with 23-bookworm:

123.0 npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
123.0 npm error In file included from /root/.cache/node-gyp/23.6.0/include/node/cppgc/common.h:8,
123.0 npm error                  from /root/.cache/node-gyp/23.6.0/include/node/v8.h:23,
123.0 npm error                  from /root/.cache/node-gyp/23.6.0/include/node/node.h:73,
123.0 npm error                  from ./src/better_sqlite3.lzz:11,
123.0 npm error                  from ../src/better_sqlite3.cpp:4:
123.0 npm error /root/.cache/node-gyp/23.6.0/include/node/v8config.h:13:2: error: #error "C++20 or later required."
123.0 npm error    13 | #error "C++20 or later required."
123.0 npm error       |  ^~~~~

On search, that led me to this comment: nodegit/nodegit#2006 (comment)

Now trying with 20-bookworm and 20-alpine

@brhahlen
Copy link
Contributor Author

brhahlen commented Jan 9, 2025

I'm getting a successful build on node20-alpine with the additional npm install that you added.

npm ls output:

npm ls
[email protected] /opt/puter/app
+-- @eslint/[email protected]
+-- @heyputer/[email protected] -> ./src/backend
| +-- @anthropic-ai/[email protected]
[...]
| +-- [email protected]
[...]

@brhahlen
Copy link
Contributor Author

brhahlen commented Jan 9, 2025

Acutally, the latest main tag at least starts again with compose on my server.

The GUI doesn't fully work, but it's better than it was :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants