Trouble creating function with INFILE

Hi,

I’m trying to build Carl Sverre’s WASM space program. I’m stuck at loading wasm functions via local infile, like this.

Here’s an example with error.

mysql> use game;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> create or replace function pack as wasm
    ->   from local infile "agent/target/wasm32-wasi/release/agent.wasm"
    ->   with wit from local infile "agent/interface.wit";
ERROR 2636 (HY000): Forwarding Error (node-f63afd44-37f6-4685-83ab-07261c051626-master-0.svc-f63afd44-37f6-4685-83ab-07261c051626:3306): Could not load data from INFILE. Please check the file path and permissions. You may also need to enable LOCAL INFILE access. See your client documentation for more information. Alternatively, you may remove the INFILE option and upload the data as a base64 encoded string.
mysql>

We can see that local_infile is enabled in the client

mysql> SHOW GLOBAL VARIABLES LIKE 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile  | ON    |
+---------------+-------+
1 row in set (0.05 sec)

mysql>

Also, we can see from the mysql cli that local_infile is correct

morgan@LAPTOP-O1G4SPR0:~/d/o/wasm-space-program$ mysql --help | grep local-infile
  --local-infile      Enable/disable LOAD DATA LOCAL INFILE.
local-infile                              TRUE

So, I assume the issue is with the server, I try

SET GLOBAL local_infile=ON
ERROR 1227 ER_SPECIFIC_ACCESS_DENIED_ERROR: Access denied; you need (at least one of) the SUPER privilege(s) for this operation

So, I try to grant SUPER to my account, the one I’m using with the mysql client

GRANT SUPER ON *.* TO morgan
ERROR 1045 ER_ACCESS_DENIED_ERROR: Forwarding Error (node-f63afd44-37f6-4685-83ab-07261c051626-master-0.svc-f63afd44-37f6-4685-83ab-07261c051626:3306): Access denied for user '54649781-ebfa-4eb3-875e-56086bdb9203'@'10.150.0.161' (using password: )

And this is where I’m stuck. Please help.

Thanks,
Morgan

Hi Morgan,

I’m not sure exactly what’s going on here, but I’d recommend trying out pushwasm which is a tool we’ve made to simplify sending Wasm to the server.

Let me know if that avoids/solves the problem.

1 Like

Oh, that’s cool! I will definitely try. Thanks!