Skip to content
Back

Appwrite function deployment issue

  • 0
  • Web
Drake
2 Apr, 2023, 14:44

Whoa, why is it so big?

TL;DR
The user is experiencing an issue with deploying an appwrite function. They are getting a 500 status code and the code.tar.gz file is too large (61.9 mb). Recommendations are given to wrap the code in a try-catch, call res.json() or res.send() only once, and use try/catch/await instead of then() and catchError(). The user also asks about checking if the logged-in user has permission over a document or collection. A potential solution is suggested to deploy using 'appwrite deploy function'. The user shares a GitHub repo and asks about the huge size of the code.tar.gz file.
Berserker
2 Apr, 2023, 15:29

@Steven on click => i managed to created the function execution

Drake
2 Apr, 2023, 15:30

And?

Berserker
2 Apr, 2023, 15:31

I was unable to deploy the function coz' the code.tar.gz file was abt 61.9 mb @Steven

Drake
2 Apr, 2023, 15:32

So your primary problem is deploying the function...nothing related to creating an execution, right?

Berserker
2 Apr, 2023, 15:33

@Steven yup

Berserker
2 Apr, 2023, 15:33

@Steven how the code.tar.gz file got that huge ? Any prob with my code ?

Drake
2 Apr, 2023, 15:34

Ya...I was hoping you could tell us that

safwan
2 Apr, 2023, 15:35

can you possibly upload all your function code to github or something?

safwan
2 Apr, 2023, 15:35

I'm very curious as to why this is happening πŸ‘€

Drake
2 Apr, 2023, 15:35

This might not be right either...

Berserker
2 Apr, 2023, 15:35

@safwan Okie already have a repo

Berserker
2 Apr, 2023, 15:39

@safwan https://github.com/antonrejoe/Notes here is the repo

Drake
2 Apr, 2023, 15:40

Can you try deploying using appwrite deploy function?

Berserker
2 Apr, 2023, 15:40

@safwan and @Steven I have a doubt is there any way to check if the current logged in user has permission over a particular document or collection etc.

Berserker
2 Apr, 2023, 15:41

@Steven it's working rn

Drake
2 Apr, 2023, 15:41

If they can get the document, they can read it. Then, look at the $permissions on the document to see if they can update or delete

Drake
2 Apr, 2023, 15:42

You were probably trying to deploy your whole folder leading to 90mb

Berserker
2 Apr, 2023, 15:42

@Steven okie dokie

Berserker
2 Apr, 2023, 16:02

@Steven rn it's returning 500 status code

Drake
2 Apr, 2023, 16:09

This usually happens because there's some problem with the function code or the code is throwing an exception

Berserker
2 Apr, 2023, 16:10

@Steven here is the function code in index.js

Drake
2 Apr, 2023, 16:14

Recommendations:

  1. Wrap everything in a try catch yo prevent your code from throwing an exception
  2. Make sure to always call res.json() or res.send() exactly once 3 don't use then() and catchError(). Use try/catch/await instead
Berserker
2 Apr, 2023, 16:15

@Steven okie

Drake
2 Apr, 2023, 16:16

And don't res.send(error). Maybe do error.toString()

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