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

bun run build:stable in Hello World example always fails #30

Open
shakfu opened this issue Nov 21, 2024 · 6 comments
Open

bun run build:stable in Hello World example always fails #30

shakfu opened this issue Nov 21, 2024 · 6 comments

Comments

@shakfu
Copy link

shakfu commented Nov 21, 2024

Is there a way to build the hello world example without using fetch and without failing?

% bun run build:stable
$ electrobun build env=stable
skipping codesign
skipping notarization
compressing tarball...
compressed 12452167 bytes from 49925632 bytes
skipping codesign
skipping notarization
creating dmg...
skipping codesign
skipping notarization
creating artifacts folder...
deleting artifact folder:  ~/projects/electro/artifacts/stable
creating update.json...
bucketUrl:
generating a patch from the previous version...
8395 |     await Bun.write(join(artifactFolder, "update.json"), updateJsonContent);
8396 |     console.log("bucketUrl: ", config.release.bucketUrl);
8397 |     console.log("generating a patch from the previous version...");
8398 |     const urlToPrevUpdateJson = join(config.release.bucketUrl, buildEnvironment, `update.json`);
8399 |     const cacheBuster = Math.random().toString(36).substring(7);
8400 |     const updateJsonResponse = await fetch(urlToPrevUpdateJson + `?${cacheBuster}`);
                                            ^
TypeError: fetch() URL is invalid
 code: "ERR_INVALID_ARG_VALUE"

      at /$bunfs/root/electrobun:8400:38
error: script "build:stable" exited with code 1
@gburnett
Copy link

@shakfu I get the same error. I fixed it by adding the following to my electrobun.config file:

{  
  "release": {
    "bucketUrl": "http://localhost:3000/upload"
  }
}

I don't have a storage bucket to I just setup a dummy server locally. It didn't care what happened with the request and I just looked in artifacts/stable for the build.

@shakfu
Copy link
Author

shakfu commented Nov 24, 2024

@shakfu I get the same error. I fixed it by adding the following to my electrobun.config file...

Thanks 👍

@shakfu
Copy link
Author

shakfu commented Nov 25, 2024

Even after adding the dummy bucketUrl as advised and updating to the latest electrobun version, I still get an error:

bucketURL not found:  8384 |     });
8385 |     await Bun.write(join(artifactFolder, "update.json"), updateJsonContent);
8386 |     console.log("bucketUrl: ", config.release.bucketUrl);
8387 |     console.log("generating a patch from the previous version...");
8388 |     const urlToPrevUpdateJson = join(config.release.bucketUrl, buildEnvironment, `update.json`);
8389 |     const updateJsonResponse = await fetch(urlToPrevUpdateJson + `?${cacheBuster}`).catch((err) => {
                                                 ^
TypeError: fetch() URL is invalid
 code: "ERR_INVALID_URL"

      at /$bunfs/root/electrobun:8389:43

8388 |     const urlToPrevUpdateJson = join(config.release.bucketUrl, buildEnvironment, `update.json`);
8389 |     const cacheBuster = Math.random().toString(36).substring(7);
8390 |     const updateJsonResponse = await fetch(urlToPrevUpdateJson + `?${cacheBuster}`).catch((err) => {
8391 |       console.log("bucketURL not found: ", err);
8392 |     });
8393 |     if (updateJsonResponse.ok) {
                                 ^
TypeError: undefined is not an object (evaluating 'updateJsonResponse.ok')
      at /$bunfs/root/electrobun:8393:27
error: script "build:stable" exited with code 7

Do I have actually have a dummy server running?

@gburnett
Copy link

@shakfu I had a dummy server running at the specified location.

@shakfu
Copy link
Author

shakfu commented Nov 26, 2024

@gburnett thanks for the clarification.

I think this is bound to confuse newcomers..

@gburnett
Copy link

I think this is bound to confuse newcomers..

Yes, quite likely that it will. I would guess that, in future, the maintainers will check for the existence of this config before attempting the request. It might be an easy PR for someone to contribute.

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