Skip to content

[Extension Bug] Bitwarden Error #510

Closed

Description

@jurildd

Extension – Bitwarden

Author: @pomdtr

Description

Can't run the Bitwarden extension. I keep getting the Something went wrong error upon running it.
image

Error log pasted below:

Error: Command failed with exit code 1: /usr/local/bin/bw status
/usr/local/Cellar/bitwarden-cli/1.20.0/libexec/lib/node_modules/@bitwarden/cli/node_modules/webidl-conversions/lib/index.js:357
    } catch {
            ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/Cellar/bitwarden-cli/1.20.0/libexec/lib/node_modules/@bitwarden/cli/node_modules/whatwg-url/dist/URL.js:3:21)

/usr/local/Cellar/bitwarden-cli/1.20.0/libexec/lib/node_modules/@bitwarden/cli/node_modules/webidl-conversions/lib/index.js:357
    } catch {
            ^

SyntaxError: Unexpected token {
createScript:vm.js:80:10
Object.runInThisContext:vm.js:139:10
Module._compile:module.js:617:28
Object.Module._extensions..js:module.js:664:10
Module.load:module.js:566:32
tryModuleLoad:module.js:506:12
Function.Module._load:module.js:498:3
Module.require:module.js:597:17
require:module.js:11:18
Object.<anonymous>:URL.js:3:21
Lr:search.js:6:57
search.js:6:10106
processTicksAndRejections:task_queues:96:5
async ke.status:search.js:11:1364
async r:search.js:6:12621

Steps To Reproduce

  1. Download Bitwarden extension
  2. Install Bitwarden CLI
  3. Try running any of the Bitwarden extension commands

The current behavior

I can't run the extension because of the error posted above.

The expected behavior

Should be able to run the extension and its commands without any issues.

Raycast version

Version: 1.26.2

Activity

  1. added
    bug
    extension
    on Dec 10, 2021
  2. pomdtr commented on Dec 10, 2021

    @pomdtr
    Contributor

    Hi, it looks like an issue with the bitwarden cli itself. Can you bw status in your terminal and see if the same error is printed ?

  3. jurildd commented on Dec 10, 2021

    @jurildd
    Author

    Hey @pomdtr, I'm not getting the error with the bw status command. I've also tried using the bw cli itself and it seems to be working fine.

  4. pomdtr commented on Dec 16, 2021

    @pomdtr
    Contributor

    I must admit I'm not a javascript expert so the traceback is not really helpful to me. Can you run node --version and which node in your terminal and write the result here?

    It looks like a syntax issue to me, so the node version used by the extension is node compatible with the cli.
    I think we should be able to resolve this by allowing the user to specify the path of it's node install.

  5. jurildd commented on Dec 17, 2021

    @jurildd
    Author

    @pomdtr I'm using v12

    ➜  ~ node --version
    v12.22.7
    ➜  ~ which node
    /Users/[username]/.nvm/versions/node/v12.22.7/bin/node
    
  6. pomdtr commented on Dec 17, 2021

    @pomdtr
    Contributor

    Thanks, I'll experiment with that !

  7. zhanang19 commented on Dec 24, 2021

    @zhanang19

    @pomdtr I had the same issue here.

    Here is the error log in my side:

    Error: Command failed with exit code 127: /usr/local/bin/bw status
    env: node: No such file or directory
    
    env: node: No such file or directory
    Br:search.js:6:57
    
    ---
    3: `:`
    4: `.charCodeAt(),n=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,e.length-1)),e[e.length-1]===n&&(e=e.slice(0,e.length-1)),e}});var Lt=f((ao,M)=>{"use strict";var $=require("path"),Rt=fe(),Nt=e=>{e={cwd:process.cwd(),path:process.env[Rt()],execPath:process.execPath,...e};let t,n=$.resolve(e.cwd),r=[];for(;t!==n;)r.push($.join(n,"node_modules/.bin")),t=n,n=$.resolve(n,"..");let s=$.resolve(e.cwd,e.execPath,"..");return r.push(s),r.concat(e.path).join($.delimiter)};M.exports=Nt;M.exports.default=Nt;M.exports.env=e=>{e={env:process.env,...e};let t={...e.env},n=Rt({env:t});return e.path=t[n],t[n]=M.exports(e),t}});var qt=f((co,xe)=>{"use strict";var Bt=(e,t)=>{for(let n of Reflect.ownKeys(t))Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n));return e};xe.exports=Bt;xe.exports.default=Bt});var _t=f((uo,Y)=>{"use strict";var hr=qt(),z=new WeakMap,Ft=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,r=0,s=e.displayName||e.name||"<anonymous>",o=function(...i){if(z.set(o,++r),r===1)n=e.apply(this,i),e=null;else if(t.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return n};return hr(o,e),z.set(o,r),o};Y.exports=Ft;Y.exports.default=Ft;Y.exports.callCount=e=>{if(!z.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return z.get(e)}});var $t=f(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.SIGNALS=void 0;var gr=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];J.SIGNALS=gr});var be=f(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.SIGRTMAX=R.getRealtimeSignals=void 0;var yr=function(){let e=jt-Mt+1;return Array.from({length:e},Sr)};R.getRealtimeSignals=yr;var Sr=function(e,t){return{name:`SIGRT${t+1}`,number:Mt+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}},Mt=34,jt=64;R.SIGRTMAX=jt});var Ut=f(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.getSignals=void 0;var wr=require("os"),xr=$t(),br=be(),vr=function(){let e=(0,br.getRealtimeSignals)();return[...xr.SIGNALS,...e].map(Ir)};Q.getSignals=vr;var Ir=function({name:e,number:t,description:n,action:r,forced:s=!1,standard:o}){let{signals:{[e]:i}}=wr.constants,a=i!==void 0;return{name:e,number:a?i:t,description:n,supported:a,action:r,forced:s,standard:o}}});var Ht=f(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.signalsByNumber=N.signalsByName=void 0;var Tr=require("os"),Dt=Ut(),Er=be(),Pr=function(){return(0,Dt.getSignals)().reduce(Cr,{})},Cr=function(e,{name:t,number:n,description:r,supported:s,action:o,forced:i,standard:a}){return{...e,[t]:{name:t,number:n,description:r,supported:s,action:o,forced:i,standard:a}}},kr=Pr();N.signalsByName=kr;var Ar=function(){let e=(0,Dt.getSignals)(),t=Er.SIGRTMAX+1,n=Array.from({length:t},(r,s)=>Gr(s,e));return Object.assign({},...n)},Gr=function(e,t){let n=Or(e,t);if(n===void 0)return{};let{name:r,description:s,supported:o,action:i,forced:a,standard:l}=n;return{[e]:{name:r,number:e,description:s,supported:o,action:i,forced:a,standard:l}}},Or=function(e,t){let n=t.find(({name:r})=>Tr.constants.signals[r]===e);return n!==void 0?n:t.find(r=>r.number===e)},Rr=Ar();N.signalsByNumber=Rr});var Kt=f((ho,Xt)=>{"use strict";var{signalsByName:Nr}=Ht(),Lr=({timedOut:e,timeout:t,errorCode:n,signal:r,signalDescription:s,exitCode:o,isCanceled:i})=>e?`timed out after ${t} milliseconds`:i?"was canceled":n!==void 0?`failed with ${n}`:r!==void 0?`was killed with ${r} (${s})`:o!==void 0?`failed with exit code ${o}`:"failed",Br=({stdout:e,stderr:t,all:n,error:r,signal:s,exitCode:o,command:i,escapedCommand:a,timedOut:l,isCanceled:d,killed:p,parsed:{options:{timeout:h}}})=>{o=o===null?void 0:o,s=s===null?void 0:s;let u=s===void 0?void 0:Nr[s].description,y=r&&r.code,x=`Command ${Lr({timedOut:l,timeout:h,errorCode:y,signal:s,signalDescription:u,exitCode:o,isCanceled:d})}: ${i}`,T=Object.prototype.toString.call(r)==="[object Error]",b=T?`${x}
    5: ${r.message}`:x,C=[b,t,e].filter(Boolean).join(`
    6: `);return T?(r.originalMessage=r.message,r.message=C):r=new Error(C),r.shortMessage=b,r.command=i,r.escapedCommand=a,r.exitCode=o,r.signal=s,r.signalDescription=u,r.stdout=e,r.stderr=t,n!==void 0&&(r.all=n),"bufferedData"in r&&delete r.bufferedData,r.failed=!0,r.timedOut=Boolean(l),r.isCanceled=d,r.killed=p&&!l,r};Xt.exports=Br});var Wt=f((go,ve)=>{"use strict";var Z=["stdin","stdout","stderr"],qr=e=>Z.some(t=>e[t]!==void 0),Vt=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return Z.map(r=>e[r]);if(qr(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Z.map(r=>`\`${r}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let n=Math.max(t.length,Z.length);return Array.from({length:n},(r,s)=>t[s])};ve.exports=Vt;ve.exports.node=e=>{let t=Vt(e);return t==="ipc"?"ipc":t===void 0||typeof t=="string"?[t,t,t,"ipc"]:t.includes("ipc")?t:[...t,"ipc"]}});var zt=f((yo,ee)=>{ee.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&ee.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ee.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var en=f((So,q)=>{var m=global.process;typeof m!="object"||!m?q.exports=function(){}:(Yt=require("assert"),L=zt(),Jt=/^win/i.test(m.platform),j=require("events"),typeof j!="function"&&(j=j.EventEmitter),m.__signal_exit_emitter__?w=m.__signal_exit_emitter__:(w=m.__signal_exit_emitter__=new j,w.count=0,w.emitted={}),w.infinite||(w.setMaxListeners(1/0),w.infinite=!0),q.exports=function(e,t){if(global.process===m){Yt.equal(typeof e,"function","a callback must be provided for exit handler"),B===!1&&Ie();var n="exit";t&&t.alwaysLast&&(n="afterexit");var r=function(){w.removeListener(n,e),w.listeners("exit").length===0&&w.listeners("afterexit").length===0&&te()};return w.on(n,e),r}},te=function(){!B||global.process!==m||(B=!1,L.forEach(function(t){try{m.removeListener(t,ne[t])}catch{}}),m.emit=re,m.reallyExit=Te,w.count-=1)},q.exports.unload=te,A=function(t,n,r){w.emitted[t]||(w.emitted[t]=!0,w.emit(t,n,r))},ne={},L.forEach(function(e){ne[e]=function(){if(m===global.process){var n=m.listeners(e);n.length===w.count&&(te(),A("exit",null,e),A("afterexit",null,e),Jt&&e==="SIGHUP"&&(e="SIGINT"),m.kill(m.pid,e))}}}),q.exports.signals=function(){return L},B=!1,Ie=function(){B||m!==global.process||(B=!0,w.count+=1,L=L.filter(function(t){try{return m.on(t,ne[t]),!0}catch{return!1}}),m.emit=Zt,m.reallyExit=Qt)},q.exports.load=Ie,Te=m.reallyExit,Qt=function(t){m===global.process&&(m.exitCode=t||0,A("exit",m.exitCode,null),A("afterexit",m.exitCode,null),Te.call(m,m.exitCode))},re=m.emit,Zt=function(t,n){if(t==="exit"&&m===global.process){n!==void 0&&(m.exitCode=n);var r=re.apply(this,arguments);return A("exit",m.exitCode,null),A("afterexit",m.exitCode,null),r}else return re.apply(this,arguments)});var Yt,L,Jt,j,w,te,A,ne,B,Ie,Te,Qt,re,Zt});var nn=f((wo,tn)=>{"use strict";var Fr=require("os"),_r=en(),$r=1e3*5,Mr=(e,t="SIGTERM",n={})=>{let r=e(t);return jr(e,t,n,r),r},jr=(e,t,n,r)=>{if(!Ur(t,n,r))return;let s=Hr(n),o=setTimeout(()=>{e("SIGKILL")},s);o.unref&&o.unref()},Ur=(e,{forceKillAfterTimeout:t},n)=>Dr(e)&&t!==!1&&n,Dr=e=>e===Fr.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",Hr=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return $r;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Xr=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Kr=(e,t,n)=>{e.kill(t),n(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Vr=(e,{timeout:t,killSignal:n="SIGTERM"},r)=>{if(t===0||t===void 0)return r;let s,o=new Promise((a,l)=>{s=setTimeout(()=>{Kr(e,n,l)},t)}),i=r.finally(()=>{clearTimeout(s)});return Promise.race([o,i])},Wr=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},zr=async(e,{cleanup:t,detached:n},r)=>{if(!t||n)return r;let s=_r(()=>{e.kill()});return r.finally(()=>{s()})};tn.exports={spawnedKill:Mr,spawnedCancel:Xr,setupTimeout:Vr,validateTimeout:Wr,setExitHandler:zr}});var sn=f((xo,rn)=>{"use strict";var P=e=>e!==null&&typeof e=="object"&&typeof e.pipe=="function";P.writable=e=>P(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object";P.readable=e=>P(e)&&e.readable!==!1&&typeof e._read=="function"&&typeof e._readableState=="object";P.duplex=e=>P.writable(e)&&P.readable(e);P.transform=e=>P.duplex(e)&&typeof e._transform=="function";rn.exports=P});var an=f((bo,on)=>{"use strict";var{PassThrough:Yr}=require("stream");on.exports=e=>{e={...e};let{array:t}=e,{encoding:n}=e,r=n==="buffer",s=!1;t?s=!(n||r):n=n||"utf8",r&&(n=null);let o=new Yr({objectMode:s});n&&o.setEncoding(n);let i=0,a=[];return o.on("data",l=>{a.push(l),s?i=a.length:i+=l.length}),o.getBufferedValue=()=>t?a:r?Buffer.concat(a,i):a.join(""),o.getBufferedLength=()=>i,o}});var cn=f((vo,U)=>{"use strict";var{constants:Jr}=require("buffer"),Qr=require("stream"),{promisify:Zr}=require("util"),es=an(),ts=Zr(Qr.pipeline),Ee=class extends Error{constructor(){super("maxBuffer exceeded");this.name="MaxBufferError"}};async function Pe(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};let{maxBuffer:n}=t,r=es(t);return await new Promise((s,o)=>{let i=a=>{a&&r.getBufferedLength()<=Jr.MAX_LENGTH&&(a.bufferedData=r.getBufferedValue()),o(a)};(async()=>{try{await ts(e,r),s()}catch(a){i(a)}})(),r.on("data",()=>{r.getBufferedLength()>n&&i(new Ee)})}),r.getBufferedValue()}U.exports=Pe;U.exports.buffer=(e,t)=>Pe(e,{...t,encoding:"buffer"});U.exports.array=(e,t)=>Pe(e,{...t,array:!0});U.exports.MaxBufferError=Ee});var ln=f((Io,un)=>{"use strict";var{PassThrough:ns}=require("stream");un.exports=function(){var e=[],t=new ns({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=r,t.on("unpipe",s),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",s.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function r(){return e.length==0}function s(o){e=e.filter(function(i){return i!==o}),!e.length&&t.readable&&t.end()}}});var pn=f((To,mn)=>{"use strict";var dn=sn(),fn=cn(),rs=ln(),ss=(e,t)=>{t===void 0||e.stdin===void 0||(dn(t)?t.pipe(e.stdin):e.stdin.end(t))},os=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let n=rs();return e.stdout&&n.add(e.stdout),e.stderr&&n.add(e.stderr),n},Ce=async(e,t)=>{if(!!e){e.destroy();try{return await t}catch(n){return n.bufferedData}}},ke=(e,{encoding:t,buffer:n,maxBuffer:r})=>{if(!(!e||!n))return t?fn(e,{encoding:t,maxBuffer:r}):fn.buffer(e,{maxBuffer:r})},is=async({stdout:e,stderr:t,all:n},{encoding:r,buffer:s,maxBuffer:o},i)=>{let a=ke(e,{encoding:r,buffer:s,maxBuffer:o}),l=ke(t,{encoding:r,buffer:s,maxBuffer:o}),d=ke(n,{encoding:r,buffer:s,maxBuffer:o*2});try{return await Promise.all([i,a,l,d])}catch(p){return Promise.all([{error:p,signal:p.signal,timedOut:p.timedOut},Ce(e,a),Ce(t,l),Ce(n,d)])}},as=({input:e})=>{if(dn(e))throw new TypeError("The `input` option cannot be a stream in sync mode")};mn.exports={handleInput:ss,makeAllStream:os,getSpawnedResult:is,validateInputSync:as}});var gn=f((Eo,hn)=>{"use strict";var cs=(async()=>{})().constructor.prototype,us=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(cs,e)]),ls=(e,t)=>{for(let[n,r]of us){let s=typeof t=="function"?(...o)=>Reflect.apply(r.value,t(),o):r.value.bind(t);Reflect.defineProperty(e,n,{...r,value:s})}return e},ds=e=>new Promise((t,n)=>{e.on("exit",(r,s)=>{t({exitCode:r,signal:s})}),e.on("error",r=>{n(r)}),e.stdin&&e.stdin.on("error",r=>{n(r)})});hn.exports={mergePromise:ls,getSpawnedPromise:ds}});var wn=f((Po,Sn)=>{"use strict";var yn=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],fs=/^[\w.-]+$/,ms=/"/g,ps=e=>typeof e!="string"||fs.test(e)?e:`"${e.replace(ms,'\\"')}"`,hs=(e,t)=>yn(e,t).join(" "),gs=(e,t)=>yn(e,t).map(n=>ps(n)).join(" "),ys=/ +/g,Ss=e=>{let t=[];for(let n of e.trim().split(ys)){let r=t[t.length-1];r&&r.endsWith("\\")?t[t.length-1]=`${r.slice(0,-1)} ${n}`:t.push(n)}return t};Sn.exports={joinCommand:hs,getEscapedCommand:gs,parseCommand:Ss}});var Pn=f((Co,F)=>{"use strict";var ws=require("path"),Ae=require("child_process"),xs=At(),bs=Ot(),vs=Lt(),Is=_t(),se=Kt(),xn=Wt(),{spawnedKill:Ts,spawnedCancel:Es,setupTimeout:Ps,validateTimeout:Cs,setExitHandler:ks}=nn(),{handleInput:As,getSpawnedResult:Gs,makeAllStream:Os,validateInputSync:Rs}=pn(),{mergePromise:bn,getSpawnedPromise:Ns}=gn(),{joinCommand:vn,parseCommand:In,getEscapedCommand:Tn}=wn(),Ls=1e3*1e3*100,Bs=({env:e,extendEnv:t,preferLocal:n,localDir:r,execPath:s})=>{let o=t?{...process.env,...e}:e;return n?vs.env({env:o,cwd:r,execPath:s}):o},En=(e,t,n={})=>{let r=xs._parse(e,t,n);return e=r.command,t=r.args,n=r.options,n={maxBuffer:Ls,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:n.cwd||process.cwd(),execPath:process.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...n},n.env=Bs(n),n.stdio=xn(n),process.platform==="win32"&&ws.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:n,parsed:r}},D=(e,t,n)=>typeof t!="string"&&!Buffer.isBuffer(t)?n===void 0?void 0:"":e.stripFinalNewline?bs(t):t,oe=(e,t,n)=>{let r=En(e,t,n),s=vn(e,t),o=Tn(e,t);Cs(r.options);let i;try{i=Ae.spawn(r.file,r.args,r.options)}catch(y){let g=new Ae.ChildProcess,x=Promise.reject(se({error:y,stdout:"",stderr:"",all:"",command:s,escapedCommand:o,parsed:r,timedOut:!1,isCanceled:!1,killed:!1}));return bn(g,x)}let a=Ns(i),l=Ps(i,r.options,a),d=ks(i,r.options,l),p={isCanceled:!1};i.kill=Ts.bind(null,i.kill.bind(i)),i.cancel=Es.bind(null,i,p);let u=Is(async()=>{let[{error:y,exitCode:g,signal:x,timedOut:T},b,C,E]=await Gs(i,r.options,d),k=D(r.options,b),H=D(r.options,C),Oe=D(r.options,E);if(y||g!==0||x!==null){let Re=se({error:y,exitCode:g,signal:x,stdout:k,stderr:H,all:Oe,command:s,escapedCommand:o,parsed:r,timedOut:T,isCanceled:p.isCanceled,killed:i.killed});if(!r.options.reject)return Re;throw Re}return{command:s,escapedCommand:o,exitCode:0,stdout:k,stderr:H,all:Oe,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return As(i,r.options.input),i.all=Os(i,r.options),bn(i,u)};F.exports=oe;F.exports.sync=(e,t,n)=>{let r=En(e,t,n),s=vn(e,t),o=Tn(e,t);Rs(r.options);let i;try{i=Ae.spawnSync(r.file,r.args,r.options)}catch(d){throw se({error:d,stdout:"",stderr:"",all:"",command:s,escapedCommand:o,parsed:r,timedOut:!1,isCanceled:!1,killed:!1})}let a=D(r.options,i.stdout,i.error),l=D(r.options,i.stderr,i.error);if(i.error||i.status!==0||i.signal!==null){let d=se({stdout:a,stderr:l,error:i.error,signal:i.signal,exitCode:i.status,command:s,escapedCommand:o,parsed:r,timedOut:i.error&&i.error.code==="ETIMEDOUT",isCanceled:!1,killed:i.signal!==null});if(!r.options.reject)return d;throw d}return{command:s,escapedCommand:o,exitCode:0,stdout:a,stderr:l,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}};F.exports.command=(e,t)=>{let[n,...r]=In(e);return oe(n,r,t)};F.exports.commandSync=(e,t)=>{let[n,...r]=In(e);return oe.sync(n,r,t)};F.exports.node=(e,t,n={})=>{t&&!Array.isArray(t)&&typeof t=="object"&&(n=t,t=[]);let r=xn.node(n),s=process.execArgv.filter(a=>!a.startsWith("--inspect")),{nodePath:o=process.execPath,nodeOptions:i=s}=n;return oe(o,[...i,e,...Array.isArray(t)?t:[]],{...n,stdin:void 0,stdout:void 0,stderr:void 0,stdio:r,shell:!1})}});var $s={};Mn($s,{default:()=>Nn});var c=v(require("@raycast/api")),ie=v(require("react")),Rn=v(qe());var Fe=v(require("@raycast/api")),_e=v(require("url"));function ce(e){return"```\n"+e+"\n```"}function _(e){if(!e)return e;let t={};for(let n in e)Object.hasOwnProperty.call(e,n)&&(e[n]??!1)&&(t[n]=e[n]);return t}function $e(e,t){try{let n=new _e.URL(t).hostname;return`https://www.google.com/s2/favicons?sz=${e}&domain=${n}`}catch{return Fe.Icon.Globe}}function Me(e){return e.charAt(0).toUpperCase()+e.slice(1)}var I=v(require("@raycast/api")),V=v(require("react"));var K="sessionToken";async function Un(e){try{let t=await(0,I.showToast)(I.ToastStyle.Animated,"Logging in...","It may takes some time");await e.login(),t.hide()}catch{(0,I.showToast)(I.ToastStyle.Failure,"An error occurred during login!","Please check your credentials")}}function je(e){let[t,n]=(0,V.useState)({});return(0,V.useEffect)(()=>{async function r(){let s=await(0,I.getLocalStorageItem)(K);switch(await e.status(s)){case"unlocked":n({sessionToken:s,vaultStatus:"unlocked"});break;case"locked":n({vaultStatus:"locked"});break;case"unauthenticated":await Un(e),n({vaultStatus:"locked"})}}r()},[]),[t,async r=>{r?((0,I.setLocalStorageItem)(K,r),n({sessionToken:r,vaultStatus:"unlocked"})):((0,I.removeLocalStorageItem)(K),n({vaultStatus:"locked"}))}]}var S=v(require("@raycast/api"));function Ue(){return(0,S.showToast)(S.ToastStyle.Failure,"Bitwarden CLI not found"),_jsx(S.Detail,{markdown:`# The Bitwarden CLI was not found
    7: ## Please check that:
    8: 
    9: 1. The Bitwarden CLI is [correctly installed](https://bitwarden.com/help/article/cli/#download-and-install)
    ---
    
    search.js:6:10116
    processTicksAndRejections:task_queues:96:5
    async Ge.status:search.js:11:1454
    async r:search.js:6:12632
    

    Additional notes:
    node version: v14.18.1
    node path: /Users/[username]/.nvm/versions/node/v14.18.1/bin/node
    bw version: 1.20.0
    bw path: /usr/local/bin/bw

    Hope this detail can help you to trace the issue.

  8. CryogenicPlanet commented on Jan 2, 2022

    @CryogenicPlanet

    It looks like a syntax issue to me, so the node version used by the extension is node compatible with the cli. I think we should be able to resolve this by allowing the user to specify the path of it's node install.

    @pomdtr Any updates on this?

    It was working fine when the extension installed and was using node 17, but I removed that and installed node 16 with nvm and now it doesn't work

  9. pomdtr commented on Jan 2, 2022

    @pomdtr
    Contributor

    Yeah the main issue here is that the bw cli is not contained and depends on having the node binary available in the brew install folder. The bw cli is kind of a pain to work with, I'm considering switching to rbw (an unofficial bitwarden cli).

  10. pomdtr commented on Jan 2, 2022

    @pomdtr
    Contributor

    @CryogenicPlanet Did you install the bitwarden-cli using brew or npm directly ?

  11. CryogenicPlanet commented on Jan 2, 2022

    @CryogenicPlanet

    @CryogenicPlanet Did you install the bitwarden-cli using brew or npm directly ?

    @pomdtr From brew. Would it work if I uninstalled and reinstalled from npm?

    Also the cli works fine if I call it myself for the terminal

  12. pomdtr commented on Jan 2, 2022

    @pomdtr
    Contributor

    No brew is supposed to work. Can you give me the output of the following command ?

    • on Intel Mac: ls -l /usr/local/bin/ | grep Cellar/node
    • on M1 Mac: ls -l /opt/homebrew/bin | grep Cellar/node

    If you have uninstalled the node executable on brew, the cli works fine in your terminal because it has access to your PATH, but my extension only search node in /usr/local/bin/ and /opt/homebrew/bin.

  13. pomdtr commented on Jan 2, 2022

    @pomdtr
    Contributor

    @jurildd @zhanang19 @CryogenicPlanet

    I added the ability to provide the node install dir in the pref of the extension in #591

  14. jurildd commented on Jan 4, 2022

    @jurildd
    Author

    @jurildd @zhanang19 @CryogenicPlanet

    I added the ability to provide the node install dir in the pref of the extension in #591

    Awesome, will check if it works once it's merged.

  15. added a commit that references this issue on Nov 6, 2024
  16. added a commit that references this issue on Nov 12, 2024
  17. added a commit that references this issue on Nov 3, 2026
  18. added a commit that references this issue on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugextension

    Type

    No type

    Fields

    Priority

    None yet

    Severity

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions