Back

1.4.2 Function after migration not working appwrite-executor

  • 0
  • Functions
  • Web
elemin67
11 Sep, 2023, 22:49

_APP_EXECUTOR_HOST=http://appwrite-executor/v1

TL;DR
The user is experiencing issues with a function after migration. The issue is that the environment variable 'APPWRITE_FUNCTION_JWT' is not implemented in the new version (V3) of the system. The solution is to wait for the upcoming version (1.4.3) where this issue will be fixed. Currently, there is no immediate solution suggested for the problem. The user has also tried updating the web SDK in the function but it didn't help. Restoring from a backup with the same function using version 1.3.8 works fine, so the user is wondering if they need to make changes to the working function
elemin67
11 Sep, 2023, 22:51
Drake
11 Sep, 2023, 22:52

that's all correct. maybe the network isn't right. Woud you please try running:

TypeScript
docker compose down

and make sure the networks get removed. Then, run

TypeScript
docker compose up -d
elemin67
11 Sep, 2023, 22:53

ok, trying

elemin67
11 Sep, 2023, 22:57
elemin67
11 Sep, 2023, 22:57

testing function

elemin67
11 Sep, 2023, 23:00

there is no error. But some internal error inside the funtion. Strange

elemin67
11 Sep, 2023, 23:01

like that

elemin67
11 Sep, 2023, 23:02

Do I need to touch also my working function with 1.3.8 and make changes?

elemin67
11 Sep, 2023, 23:02

if I restore from backup with the same function with 1.3.8 its working again

elemin67
11 Sep, 2023, 23:11

I guess I need also to update the web sdk in the function:

im testing it again

elemin67
11 Sep, 2023, 23:14

it doesnt helped

elemin67
11 Sep, 2023, 23:28

figure it out:

my code is:

TypeScript
  logger.info("token: " + req.variables['APPWRITE_FUNCTION_JWT']);
  if (
    !req.variables['APPWRITE_FUNCTION_ENDPOINT'] ||
    !req.variables['APPWRITE_FUNCTION_JWT']
  ) {
    logger.warn("Environment variables are not set. Function cannot use Appwrite SDK.");
  } else {
    client
      .setEndpoint(req.variables['APPWRITE_FUNCTION_ENDPOINT'])
      .setProject(req.variables['APPWRITE_FUNCTION_PROJECT_ID'])
      .setJWT(req.variables['APPWRITE_FUNCTION_JWT']) // Your users JWT
      // .setKey(req.variables['APPWRITE_FUNCTION_API_KEY'])
      .setSelfSigned(true);
    logger.info("Enviroment variables are set.")
  }

appwrite is not providing the enviorment variable: APPWRITE_FUNCTION_JWT

elemin67
11 Sep, 2023, 23:30

the req variable contains:

TypeScript
{"variables":{"APPWRITE_FUNCTION_ENDPOINT":"https://192.168.1.102:443/v1","APPWRITE_FUNCTION_PROJECT_ID":"sjdfgjk","APPWRITE_FUNCTION_ID":"jiodfjgeg8duv","APPWRITE_FUNCTION_NAME":"name","APPWRITE_FUNCTION_DEPLOYMENT":"64ffa1478604a6fc3b41","APPWRITE_FUNCTION_RUNTIME_NAME":"Node.js","APPWRITE_FUNCTION_RUNTIME_VERSION":"16.0","INERNAL_EXECUTOR_HOSTNAME":"appwrite-executor"},"headers":{},"payload":"{\"requestedFunction\":\"createContacts\",\"cKundenNrs\":[\"K20235211\"]}"}
elemin67
11 Sep, 2023, 23:30

How can we fix this issue?

Drake
11 Sep, 2023, 23:45

Ah yes...we missed this for old functions. This will be fixed in 1.4.3: https://github.com/appwrite/appwrite/pull/6215/files

elemin67
11 Sep, 2023, 23:46

ohh okay, thanks for that. Need to wait for 1.4.3 πŸ™‚

Drake
11 Sep, 2023, 23:47

ya sorry about that

elemin67
11 Sep, 2023, 23:47

when do you plan with the rollout for 1.4.3?

Drake
11 Sep, 2023, 23:50

soon...hard to say at the moment. we still need to figure out what should be fixed now vs later

elemin67
11 Sep, 2023, 23:50

okay

elemin67
12 Sep, 2023, 23:16

I miss the env APPWRITE_FUNCTION_JWT also in V3.

process.env looks:

TypeScript

Is APPWRITE_FUNCTION_JWT also not implemented in V3?

elemin67
12 Sep, 2023, 23:18
Drake
13 Sep, 2023, 00:25
Drake
13 Sep, 2023, 00:25

process.env contains stuff that doesn't change between requests. headers has the other stuff

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more