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

Latest Bit version 1.6.73 causes build failures in Ripple CI / Bit Cloud #8628

Open
coreyaus opened this issue Mar 6, 2024 · 8 comments
Open
Labels

Comments

@coreyaus
Copy link

coreyaus commented Mar 6, 2024

Describe the bug

Since the Ripple CI / Bit Cloud build process has started using Bit version 1.6.73 I've been seeing build failures on my React 18 environment (see Ripple CI logs here), which is based on @teambit/[email protected]:

  • the error occurs even if I don't update my components - just running bit tag --unmodified and exporting the results throws a build error for me on the latest Bit version
  • the bit build process still succeeds when I running it locally with any Bit version

Screenshots, exceptions and logs - error details from Ripple CI

The full build logs and all errors are visible here (the env is in a public scope): https://bit.cloud/sitestudio/envs/~ripple-ci/job/sitestudio-sitestudio-envs-rebuilding-scope/component/sitestudio.envs/[email protected]

The main part of the error message says:

PnpmError: [email protected] install: prebuild-install || node-gyp rebuild --release
Exit status 1

image

Steps to Reproduce

  1. You can see an example when comparing the last 2 versions of the tina-react-env here: https://bit.cloud/sitestudio/envs/tina-react-env/~compare
    • There are no code differences between the 2 versions
    • Version 0.0.2 built perfectly 1 month ago, while version 0.0.3 is failing to build
  2. You can import that tina-react-env and it will build fine locally
    • run bit tag --unmodified and bit export and the Ripple CI throws the error detailed above

Expected Behavior

  • New Bit versions should not lead to build failures on Ripple CI / Bit Cloud for components that were previously building successfully.
    • Or if there are errors on Ripple CI it should ideally be possible to recreate those same errors when running bit build locally
  • Alternatively a way to specify the Bit version that Ripple CI uses would provide an immediate resolution: Can we specify a Bit version to be used by Ripple CI / Bit Cloud? #8627

Specifications

  • Bit version: 1.6.73
  • Workspace type: harmony
  • Node version: 21.2.0
  • pnpm version: 7.4.0
  • Platform: Bit Cloud / Ripple CI
  • Relevant env: The tina-react-env is based on the React 18 env: @teambit/[email protected]. It only has very minor customizations
@davidfirst
Copy link
Member

For some reason I'm unable to reproduce the issue locally with the same version.
Screenshot 2024-03-05 at 9 16 32 PM

@guysaar223 , @GiladShoham , can you take a look?

@zkochan
Copy link
Member

zkochan commented Mar 6, 2024

Does it consistently fail? Even if you retry? Looks related to our virtual fs but we have not changed anything in our ripple CI package manager. I have tried running it locally in a container and it worked.

Sometimes the build is skipped, when the build artifacts are found in the cache, so maybe that is why it worked the last time.

This is definitely a bug but finding the reason will be hard if I won't be able to reproduce it locally. In that case the only way to find the reason will be to add debug messages to the virtual fs, so that more info is printed in ripple.

@zkochan
Copy link
Member

zkochan commented Mar 6, 2024

I created a new simple component with [email protected], this one builds without issues: https://bit.cloud/zoltan/dogfooding/~ripple-ci/job/zoltan-main-Gb0BJcI1A

@coreyaus
Copy link
Author

coreyaus commented Mar 6, 2024

Thanks for the quick responses on this! I really appreciate your review, particular as you say because it's always hard to debug issues when it's not possible to reproduce them locally so thanks for your time so far 🙏

In answer to your first question, it is failing consistently at the moment, even when retrying. Happily it's a pretty simple env to recreate or replace so I'll run a test now to see if it builds successfully when recreated from scratch. The only customisations in that env are these 3 extra peer dependencies added to the host-dependencies.ts and env.jsonc files:

  • tinacms
  • @tinacms/mdx
  • @tinacms/schema-tools

The env doesn't depend on better-sqlite3 directly but that package is included indirectly due to the dependency on tinacms, via the following path:

Let me know if those notes trigger any insights and I'll report back shortly once I've finished creating a fresh version of the env from scratch (I'm halfway through that process now) 👍

@coreyaus
Copy link
Author

coreyaus commented Mar 6, 2024

The update is that I just finished recreating that env from scratch and ran into the same error: https://bit.cloud/sitestudio/envs/~ripple-ci/job/sitestudio-main-update-test-react-env-to-include-extra-peer-dependencies

Steps to reproduce:

Here are the steps I followed to re-create that env from scratch. Please let me know if there's something I'm missing or doing wrong (and apologies in advance if that's the case!):

  1. Created a new workspace and test-react-env:

    mkdir temp-new-bit-workspace && cd temp-new-bit-workspace
    bit init --default-scope=sitestudio.envs
    bit create react-env test-react-env --aspect teambit.react/react-env --scope=sitestudio.envs
    bit install --add-missing-deps
    bit tag --message "Create base test-react-env"
    bit export
  2. Manually added the latest versions of the 3 extra dependencies mentioned above (tinacms, @tinacms/mdx & @tinacms/schema-tools) to the host-dependencies.ts and env.jsonc files (see this code diff), then ran the following commands to tag and export those updates:

    bit install --add-missing-deps
    bit tag --message "Update test-react-env to include extra peer dependencies"
    bit export

Please let me know if I missed something in that process, or if there are any other changes you'd like me to test. Would it be helpful to manually configure better-sqlite3 as a dependency somewhere within the workspace or env (or manually override the version as a test)?

Thanks again!

@zkochan
Copy link
Member

zkochan commented Mar 6, 2024

Thanks for the new details. I was able to reproduce the issue locally in a ripple container using a fork of sqlite that I used in my component. Using this command.

bit sign zoltan.dogfooding/[email protected] --multiple --rebuild

@coreyaus
Copy link
Author

Thanks for your work on this @zkochan and great to hear you were able to reproduce the issue locally.

I wanted to check in with a couple of quick questions:

  1. Are there are any tests I can run to help your work delivering a fix?
  2. Have you found any workarounds in the meantime?

I'm currently unable to build or update an environment if it uses a package that includes better-sqlite3 in its dependencies. Thanks for any help you can offer!


Things I've tried

  1. Setting better-sqlite3 as an explicit dependency of the env in the host-dependencies.ts and env.jsonc files

  2. Trying to remove the dependency based on the docs here: https://bit.cloud/teambit/dependencies/aspect-docs/dependency-resolver/~compositions

    "teambit.dependencies/dependency-resolver": {
      "packageManager": "teambit.dependencies/pnpm",
      "policy": {
        "dependencies": {
          "better-sqlite3": "-"
        },
        "peerDependencies": {
          "better-sqlite3": "-"
        }
      },
    },
  3. Adding better-sqlite3 to the neverBuiltDependencies array (again based on these docs)

Unfortunately none of those approaches worked (you can probably tell I was mostly just trying everything I could think of!)

PS: It looks like Ripple CI is now using a not-yet-released version of Bit (1.6.84) to run the build process - is that right?

@zkochan
Copy link
Member

zkochan commented Mar 14, 2024

Right now the only solution would be to turn off fusepm (cc @guysaar223) or somehow build the package outside of the mounted directory.

I spent about 2 days debugging it but couldn't figure out the issue. The better_sqlite3.o file seems to have the wrong file type. It is data instead of ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped. Looks like the C compiler can't complete the compilation correctly on the Fuse filesystem.


removing better-sqlite3 or adding it to neverBuiltDependencies should work though. I should check this.

coreyaus added a commit to coreyaus/sqlite-level that referenced this issue Mar 15, 2024
This is a pretty niche issue but you can see more info about it here: teambit/bit#8628
coreyaus added a commit to code-nation/tinacms-without-better-sqlite3 that referenced this issue Mar 16, 2024
We're doing this because the `@tinacms/search` package uses `sqlite-level`, which in turn depends on the `better-sqlite3` package that is breaking the builds on Build Cloud / Ripple CI: teambit/bit#8628
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants