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

Not works with js-ipfs #2564

Closed
conanchen opened this issue Sep 1, 2021 · 7 comments
Closed

Not works with js-ipfs #2564

conanchen opened this issue Sep 1, 2021 · 7 comments

Comments

@conanchen
Copy link

conanchen commented Sep 1, 2021

Describe the bug

js-ipfs is not functionable

To Reproduce

  1. create a vue3 component
<template>
  <div class="ipfs-info">
    <img class="ipfs-logo" alt="IPFS logo" src="../assets/logo.svg" />
    <h1>{{ status }}</h1>
    <h2>ID: {{ id }}</h2>
    <h2>Agent version: {{ agentVersion }}</h2>
  </div>
</template>

<script>
import IPFS from "ipfs";

export default {
  name: "IpfsInfo",

  data: function () {
    return {
      status: "Connecting to IPFS...",
      id: "",
      agentVersion: "",
    };
  },

  async mounted() {
    try {
      // Await for ipfs node instance.
      const ipfs = await IPFS.create();

      // Call ipfs `id` method.
      // Returns the identity of the Peer.
      const { agentVersion, id } = await ipfs.id();
      this.agentVersion = agentVersion;
      this.id = id;
      // Set successful status text.
      this.status = "Connected to IPFS =)";
    } catch (err) {
      // Set error status text.
      this.status = `Error: ${err}`;
    }
  },
  methods: {},
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.ipfs-logo {
  height: 10rem;
}
</style>

Expected behavior

A clear and concise description of what you expected to happen.

should get ipfs information on vue page

Screenshots

If applicable, add screenshots to help explain your problem.

  1. screen shot for tauri-app
    image

  2. screen shot for browser
    image

Platform and Versions (required):

app:spawn Running "vue-tauri-ipfs-app/node_modules/@tauri-apps/cli/bin/tauri-cli tauri info" +0ms

Operating System - Mac OS, version 11.5.2 X64

Node.js environment
Node.js - 16.4.1
@tauri-apps/cli - 1.0.0-beta.6
@tauri-apps/api - Not installed

Global packages
npm - 7.21.0
yarn - 1.22.10

Rust environment
rustc - 1.54.0
cargo - 1.54.0

App directory structure
/node_modules
/public
/src-tauri
/src

App
tauri.rs - 1.0.0-beta.8
build-type - bundle
CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
distDir - Set automatically by Vue CLI plugin
devPath - Set automatically by Vue CLI plugin
framework - Vue.js (Vue CLI)
bundler - Webpack

✨ Done in 12.48s.


### **Additional context**
1. if introspect element from the tauri-app 

Compiling app v0.1.0 (/Users/CC/github/moreadgroup/moread-cloud-functions/flipeb-dapp/src-tauri)
    Finished dev [unoptimized + debuginfo] target(s) in 6.06s
     Running `target/debug/app`
2021-09-01 19:57:58.160 app[44927:474556] NSWindow warning: adding an unknown subview: <WKInspectorWKWebView: 0x7f9698f82bc0>. Break on NSLog to debug.
2021-09-01 19:57:58.172 app[44927:474556] Call stack:
(
        0   AppKit                              0x00007fff22e5a7b5 -[NSThemeFrame addSubview:] + 112
        1   AppKit                              0x00007fff22e5a4f4 -[NSView addSubview:positioned:relativeTo:] + 203
        2   AppKit                              0x00007fff22e5a3ae -[NSThemeFrame addSubview:positioned:relativeTo:] + 46
        3   WebKit                              0x00007fff3c170071 _ZN6WebKit17WebInspectorProxy14platformAttachEv + 391
        4   WebKit                              0x00007fff3c5ab1ea _ZN6WebKit17WebInspectorProxy4openEv + 84
        5   WebKit                              0x00007fff3c76ec33 _ZN6WebKit17WebInspectorProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 259
        6   WebKit                              0x00007fff3c1bb94f _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7DecoderE + 125
        7   WebKit                              0x00007fff3c548228 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 28
        8   WebKit                              0x00007fff3c19d3b6 _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_14default_deleteIS3_EEEE + 700
        9   WebKit                              0x00007fff3c19cbf4 _ZN3IPC10Connection24dispatchIncomingMessagesEv + 488
        10  JavaScriptCore                      0x00007fff375b85dd _ZN3WTF7RunLoop11performWorkEv + 573
        11  JavaScriptCore                      0x00007fff375b934a _ZN3WTF7RunLoop11performWorkEPv + 26
        12  CoreFoundation                      0x00007fff2062b94c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
        13  CoreFoundation                      0x00007fff2062b8b4 __CFRunLoopDoSource0 + 180
        14  CoreFoundation                      0x00007fff2062b634 __CFRunLoopDoSources0 + 242
        15  CoreFoundation                      0x00007fff2062a05c __CFRunLoopRun + 893
        16  CoreFoundation                      0x00007fff2062961c CFRunLoopRunSpecific + 563
        17  HIToolbox                           0x00007fff2886fa83 RunCurrentEventLoopInMode + 292
        18  HIToolbox                           0x00007fff2886f7e5 ReceiveNextEventCommon + 587
        19  HIToolbox                           0x00007fff2886f583 _BlockUntilNextEventMatchingListInModeWithFilter + 70
        20  AppKit                              0x00007fff22e31172 _DPSNextEvent + 864
        21  AppKit                              0x00007fff22e2f945 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1364
        22  AppKit                              0x00007fff22e21c69 -[NSApplication run] + 586
        23  app                                 0x000000010dc67106 _ZN60_$LT$$LP$$RP$$u20$as$u20$objc..message..MessageArguments$GT$6invoke17h342ba06e4a2eb646E + 70
        24  app                                 0x000000010dc69d82 _ZN4objc7message8platform15send_unverified17h97f63312310fd221E + 98
        25  app                                 0x000000010dac922b _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$10run_return17hd6e6abe1c9471ec6E + 1355
        26  app                                 0x000000010dac956d _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$3run17h67f8b26ce84a9cf0E + 61
        27  app                                 0x000000010d8e67cc _ZN3tao10event_loop18EventLoop$LT$T$GT$3run17h5f0927e4210e9e29E + 108
        28  app                                 0x000000010dac163a _ZN65_$LT$tauri_runtime_wry..Wry$u20$as$u20$tauri_runtime..Runtime$GT$3run17h1946e2b9c1076d02E + 1050
        29  app                                 0x000000010dac5392 _ZN5tauri3app12App$LT$R$GT$3run17he9eda91397ae2b28E + 338
        30  app                                 0x000000010dac5a08 _ZN5tauri3app16Builder$LT$R$GT$3run17h85d439ffcd15b90eE + 200
        31  app                                 0x000000010d8e0eae _ZN3app4main17heaa859e18bfd320fE + 4062
        32  app                                 0x000000010d8bf22e _ZN4core3ops8function6FnOnce9call_once17h734dd5f2b73c8214E + 14
        33  app                                 0x000000010d81cdb1 _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h3184ca8c174e111dE + 17
        34  app                                 0x000000010d7befc4 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17he10a9f60f87bbafeE + 20
        35  app                                 0x000000010e10f481 _ZN3std2rt19lang_start_internal17h4428f22d05a79c62E + 641
        36  app                                 0x000000010d7bef9e _ZN3std2rt10lang_start17heed1771d389451e1E + 46
        37  app                                 0x000000010d8e0f76 main + 22
        38  libdyld.dylib                       0x00007fff2054df3d start + 1
        39  ???                                 0x0000000000000001 0x0 + 1
)


### **Stack Trace**
<!-- add if applicable -->
@fanninpm
Copy link

fanninpm commented Sep 9, 2021

What does your Rust backend look like? What does your tauri.conf.json file look like?

@amrbashir
Copy link
Member

Please provide minimal repro.

@amrbashir
Copy link
Member

amrbashir commented Nov 14, 2021

Closing this until a minimal repro is provided with the latest tauri version or someone else confirms the behavior.

@vdvman1
Copy link

vdvman1 commented Nov 15, 2021

I think js-ipfs uses WebRTC internally, so it may be related to tauri-apps/wry#85
(They appear to be using MacOS in their screenshots, which can use WebRTC after doing some more work, which is described in the comments of that issue)

@amrbashir
Copy link
Member

thanks for clarification, if that's the case then this issue should stay closed. we already have issues for webrtc.

@wusyong
Copy link
Member

wusyong commented Nov 15, 2021

Our bundler should include the plist iirc

@conanchen
Copy link
Author

conanchen commented Nov 14, 2022

Please provide minimal repro.
@amrbashir
https://github.com/moreadgroup/tauri-ipfs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants