#PluginInitialization("shell", "unknown field `allow`, expected `open`")

71 messages ยท Page 1 of 1 (latest)

twilit bear
#

Hi! I'm on the latest beta and after following the doc to create a new command, I get this error. Any idea to fix this? Thanks :D

#

I tried following this https://github.com/tauri-apps/plugins-workspace/blob/53c0e898608b2fe96d20e417905674ca41d8a089/examples/api/src-tauri/capabilities/base.json#L33-L42 but still get the same result, error.
This is my attempt, maybe my JSON is wrong..?

  "plugins": {
    "shell": {
      "identifier": "shell:allow-execute",
      "allow": [
        {
          "name": "legendary-auth",
          "cmd": "legendary",
          "args": [
            "auth"
          ]
        }
      ]
    }
  }```

```ts
import { Command } from "@tauri-apps/plugin-shell";

Command.create('legendary-auth', 'auth').execute()```
GitHub

All of the official Tauri plugins in one place! Contribute to tauri-apps/plugins-workspace development by creating an account on GitHub.

sturdy spade
#

That syntax looks like you're editing src-tauri/tauri.conf.json rather than src-tauri/capabilities/default.json (might be called migrated.json).

twilit bear
sturdy spade
#

It's also the file you linked ๐Ÿ˜…

#

You can call the capabilities files whatever you like, the default files are just called default and migrated depending on what generated them, create-tauri-app and tauri migrate respectively.

twilit bear
#

Oh, I didn't saw, I thought it was the same file as v1 :')

#

It works like a charm, thank you so much!

#

And where would I see all the options, for example for the fs?

sturdy spade
#

You can point the $schema field at src-tauri/gen/schemas/acl-manifest.json or read the file manually. It's intended for editors to provide auto-complete so it's a little bit hard to read without formatting it.

#

My mistake. It was plural: acl-manifests.json.

twilit bear
#

Saw that yup. By the way in the link I provided, it pointed to desktop-schema.json. Is it normal or a bug?

sturdy spade
#

That's normal.

twilit bear
sturdy spade
#

Hm... seems it's in a different format than I remember. Maybe it was the desktop-schema.json file instead.

twilit bear
#

Hmmm

#

Expected type "string"

#

^ with desktop-schema.json. Doesn't seem to work alot

sturdy spade
#

Hm... "permissions" should be on the root.

#

You only need to specify it once.

twilit bear
#

Oh, see it already there, I'm blind

twilit bear
#
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "Capability for the main window",
  "windows": ["main"],
  "permissions": [
    "event:default",
    "window:default",
    "app:default",
    "image:default",
    "resources:default",
    "menu:default",
    "tray:default",
    {
      "identifier": "shell:allow-execute",
      "allow": [
        {
          "name": "legendary-auth",
          "cmd": "legendary",
          "args": [
            "auth"
          ]
        }
      ]
    },
    "path:allow-join"
  ]
}``` it only wants to autocomplete the shell identifier, why? It's frustrating me so much haha
sturdy spade
#

What editor are you using?

twilit bear
#

VSCode

sturdy spade
#

It generates the schema files every build so you should have more than shell in there.

twilit bear
#

Wherever I try to add another thing, for the allow path, it tries and wants to autocomplete for the shell

sturdy spade
#

Oh, that's a side-effect of the way the schema is handled.

twilit bear
#

And in the examples I can see fs used, and I can only see path

sturdy spade
#

What permission were you trying to add?

twilit bear
#

A permission to allow me to edit the .zshrc file in the home directory for example

sturdy spade
#

You also have to reload VSCode to get it to pick up the schema again.

#

I find that really annoying too ๐Ÿ˜…

twilit bear
#

Let me try by reloading it

sturdy spade
#

There's even a JSON: Clear Schema Cache command but it doesn't seem to make a difference.

twilit bear
#

Nothing changed. Also, in my shell identifier it throws me a warning because there is no command and sidecar property

sturdy spade
#

Have you run tauri dev or tauri build since you added the plugins?

twilit bear
#

Well, just did but nothing changed

sturdy spade
#

Seems regenerating the schemas has broken for some reason. It doesn't overwrite the existing files.

#

Should be fine to delete gen/schemas so it get generated next build.

#

I'll look into the cause when I have a moment in the evening.

twilit bear
#

I found my first bug ๐Ÿฅณ

sturdy spade
#

Can you upload a minimum reproduction to GitHub?

#

If you've only got the output of create-tauri-app so far, that works too.

twilit bear
#

I just got the basic file from bun create tauri-app@latest -- --beta, nothing changed. How would I get a minimum reproduction..? ^^'

sturdy spade
#

Did you also run tauri add fs?

twilit bear
#

.....................

#

Wait a few seconds ^^'

sturdy spade
#

That's just a shortcut to automatically add the plugin. You could also have manually added it to Cargo.toml, package.json, and lib.rs.

twilit bear
#

I'm just a fool who tried to do his stuff in the wrong order

#

Guess who has autocomplete for fs now

sturdy spade
#

That's good. I thought something had gone wrong in the ACL which is code I haven't looked at yet.

twilit bear
#

It's usual on my end when I have a problem haha, don't worry

#

So whenever I want to add any identifier, I need to add it to Tauri first right?

sturdy spade
#

Only if it's a plugin.

#

Most stuff is a plugin though.

twilit bear
#

Got it. One last thing, my command works but why doesn't it accept my shell:allow-execute? It throws me a warning there, it wants any fs identifier

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "Capability for the main window",
  "windows": ["main"],
  "permissions": [
    "event:default",
    "window:default",
    "app:default",
    "image:default",
    "resources:default",
    "menu:default",
    "tray:default",
    "fs:default",
    {
      "identifier": "shell:allow-execute",
      "allow": [
        {
          "name": "legendary-auth",
          "cmd": "legendary",
          "args": [
            "auth"
          ]
        }
      ]
    }
  ]
}```
sturdy spade
#

Not sure what causes that behaviour. It doesn't seem to cause any compile errors so it's probably just a problem with the schema file.

twilit bear
#

Maybe I should try to delete it again? Or wait for a future update

sturdy spade
#

Future update, I tried deleting it and it didn't make a difference.

twilit bear
#

And quick question, is the upgrade command the same as the install command for beta?

sturdy spade
#

Upgrade command?

#

You mean with pnpm and Yarn?

#

I think they behave the same when you specify a package and version.

twilit bear
sturdy spade
#

I don't see a bun upgrade in their docs.

twilit bear
#

So still bun create tauri-app@latest -- --beta?

sturdy spade
#

I don't know if the extra -- is needed for Bun but yes, that should do it.