Back

[SOLVED] migration error on appwrite 1.4.1

  • 0
  • Self Hosted
  • General
Faisal7
14 Sep, 2023, 20:19

And i added as main terget lib/main.dart as mentioned in starter-function readme

TL;DR
User had a migration error on Appwrite 1.4.1. They had trouble sending secrets (like passwords) to the function from the client SDK (Flutter). The problem was solved by changing the environment variable's name from a dash to an underscore. They also had trouble accessing environment variables in Dart, but this was resolved by migrating their old functions to the new function syntax. The user updated their Dart version in the .env file, recreated the Appwrite instance, and deployed the starter function with the Dart 3 runtime. They were then able to deploy the function successfully. No storage provider was being used. The user mentioned that
Drake
14 Sep, 2023, 20:39

btw, you should upgrade to 1.4.2

Drake
14 Sep, 2023, 20:40

so your function starter has folder structure like this? with lib/main.dart? https://github.com/appwrite/functions-starter/tree/v3/dart-3.0

Faisal7
14 Sep, 2023, 20:59

Yes exactly but i picked the dart 2.17

Faisal7
14 Sep, 2023, 21:10

oh i forgot to mention it. I am already using the 1.4.2

Faisal7
14 Sep, 2023, 21:10

the local instance as well as the instance in my NAS

Drake
14 Sep, 2023, 22:37

are you using some storage provider?

Drake
14 Sep, 2023, 22:37

and how did you deploy your function?

Faisal7
15 Sep, 2023, 09:44

no i am not using any storage provider.

Faisal7
15 Sep, 2023, 09:44

now i am able to deploy my function

Faisal7
15 Sep, 2023, 09:47

what i did was i just updated my dart in .env file of appwrite so i used dart-3.0 instead dart-2.17 and then recreated the appwrite instance with docker compose up -d and then deploayd the starter-function with dart 3 runtime and now i am able to execute it.

Faisal7
15 Sep, 2023, 09:47

i think i need to migrate then my old functions to the new function syntax as well. Its a bit diffderent now.

Faisal7
15 Sep, 2023, 09:49

the problem with functions i have now is that i am getting null when trying to access the environment variables with Platform.environment['api_key'] i setted the environment variable in my function setting and tryed to access it in dart but i am getting null what could be the cause? Or is it something i am doing wrong to get the environment variable.

Drake
15 Sep, 2023, 17:46

please create a new post since this is a different topic

Faisal7
15 Sep, 2023, 18:30

Yes i solved the problem by naming the environment variables with underscore instead minus so instead api-key => api_key. I wish this could be mention in somewhere. But is it like something that the environment variables must be named by underscore that i should new about it or what?

Drake
15 Sep, 2023, 18:31

weirrd..i didn't think that would be a problem..

Drake
15 Sep, 2023, 18:37

i just tested with a dash and it works for me 🧐

Faisal7
15 Sep, 2023, 18:40

Oh really interesting i changed it from dash to underscore it worked. I thought this could be the case but. What could be then the cause i am curius now.

Drake
15 Sep, 2023, 18:43

maybe function wasn't redeployed the first time?

Faisal7
19 Sep, 2023, 10:21

i dont know i tryed again right now with dash its not working. Maybe i am doing something else not correct. I will then figure this out what i did wrong later.

Faisal7
19 Sep, 2023, 10:23

but have a question how do i send secrets for example passwords for resetting or some other secrets to the function from client sdk (flutter).

Faisal7
19 Sep, 2023, 10:29

right now i am sending it to the body

Drake
19 Sep, 2023, 20:34

please create a new post

Faisal7
19 Sep, 2023, 20:45

Ok of course thank you for your support.

Faisal7
19 Sep, 2023, 20:46

[SOLVED] migration error on appwrite 1.4.1

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