Skip to content

🐛 Bug Report: Pre 1.4 function doesn't work #6128

@stnguyen90

Description

@stnguyen90

👟 Reproduction steps

  1. start on Appwrite version 1.3.8
  2. create a function that works
  3. upgrade to 1.4.x
  4. execute the function

👍 Expected behavior

The function executes successfully.

👎 Actual Behavior

Error occurs.

Here's the exeuction result:

{
  "$id": "64f41a33aa19a4085416",
  "$createdAt": "2023-09-03T05:31:31.697+00:00",
  "$updatedAt": "2023-09-03T05:31:42.595+00:00",
  "$permissions": [
    "read(\"user:62f160ce77c57e6e6ac3\")"
  ],
  "functionId": "dump",
  "trigger": "http",
  "status": "failed",
  "requestMethod": "GET",
  "requestPath": "/",
  "requestHeaders": [],
  "responseStatusCode": 500,
  "responseBody": "",
  "responseHeaders": [],
  "logs": "",
  "errors": "An internal curl error has occurred within the executor! Error Msg: Operation timed out\\nError Code: 500",
  "duration": 10.888585090637
}

The function seems to try to build, but then fails. You can see it exited:

image

Inspecting the container gives:

[
    {
        "Id": "f9452024db1d3f24dfb96f8355d8d0f21c2d752410b68171ecc11a77795c319e",
        "Created": "2023-09-03T05:31:31.804240093Z",
        "Path": "sh",
        "Args": [
            "-c",
            "cp /tmp/code.tar.gz /mnt/code/code.tar.gz \u0026\u0026 nohup helpers/start.sh \"src/function/server\""
        ],
        "State": {
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 127,
            "Error": "",
            "StartedAt": "2023-09-03T05:31:32.047404259Z",
            "FinishedAt": "2023-09-03T05:31:32.055148676Z"
        },
        "Image": "sha256:4c0bda687e945d844c251a796c585e910c7df8ab4f1cd22baeea4f4c2fed7dea",
        "ResolvConfPath": "/var/lib/docker/containers/f9452024db1d3f24dfb96f8355d8d0f21c2d752410b68171ecc11a77795c319e/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/f9452024db1d3f24dfb96f8355d8d0f21c2d752410b68171ecc11a77795c319e/hostname",
        "HostsPath": "/var/lib/docker/containers/f9452024db1d3f24dfb96f8355d8d0f21c2d752410b68171ecc11a77795c319e/hosts",
        "LogPath": "/var/lib/docker/containers/f9452024db1d3f24dfb96f8355d8d0f21c2d752410b68171ecc11a77795c319e/f9452024db1d3f24dfb96f8355d8d0f21c2d752410b68171ecc11a77795c319e-json.log",
        "Name": "/executor-delete-64dfa5229e6439a2c5f2",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/tmp/executor-delete-64dfa5229e6439a2c5f2/src:/tmp:rw",
                "/tmp/executor-delete-64dfa5229e6439a2c5f2/builds:/usr/code:rw"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "runtimes",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "private",
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 1073741824,
            "NanoCpus": 1000000000,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 2147483648,
            "MemorySwappiness": null,
            "OomKillDisable": null,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/7b68455a3154e16a766784819e39c5c5286bb79c29a0283561a1c83d8bc9109c-init/diff:/var/lib/docker/overlay2/edb209217e46dda6d6387eb3ef85119839e5a450f957ae363f41a1a28a52d42c/diff:/var/lib/docker/overlay2/be6dc5f0d21015a14ce6d28d17c176e16834638b92729f16fa67043c2894647e/diff:/var/lib/docker/overlay2/0f393cbf173eff6d0d95e6347a3c5218f0e17df23d2834be740aa2dd4a3a1e23/diff:/var/lib/docker/overlay2/25b929db86c0cb0767b80c95b44b55770f2ed814985fbaec0d673b8f2be9b741/diff:/var/lib/docker/overlay2/cf0976fb09c624f5b916fe50d0153217d8e6825b56d31ee9abfca96c49402431/diff:/var/lib/docker/overlay2/e836d2bfe8e96368fc88343c91c7a07fadfb8f59d3dbbc907782c2ea5fb7b99c/diff:/var/lib/docker/overlay2/6acc6f12e42c3e5fa9f6e5ef496e0f4ca2e602b1397832eed4aa3648baf79e60/diff:/var/lib/docker/overlay2/92156e18c3a117e646a1a687f72686d48abbeeec5e5130f51a7ded49fef4a3a7/diff:/var/lib/docker/overlay2/70afa3e5676e61e6884292e1dbf25890c8475331a864b4d99a2dc38441eb96a8/diff:/var/lib/docker/overlay2/97ef5e6a84e29b9023bf6482f6ef5d05a4eff28942b96c36186741e627f11199/diff:/var/lib/docker/overlay2/9f98e25a6bdfad3c06608d4ace03cd5aa4df839f977c0e8192240431c945d076/diff:/var/lib/docker/overlay2/3bcbdf586385bb095ffad464ca848988e550c3d66ca36c81261ad7be51d5d37a/diff:/var/lib/docker/overlay2/e9a0fc794e6788602b15fbb78c19412dd0b9d4688d2edd10102705b6063ef10f/diff:/var/lib/docker/overlay2/16fc8e6ed4e23c76869d703af39bf0d09223477a7c34fabf87c4f165cdedf69c/diff:/var/lib/docker/overlay2/fea178ac347535e39b60000346b112b5ba40666ae08882926930428bcdc4efc6/diff:/var/lib/docker/overlay2/4113038a8db65190dd10574a50585bedecd45ec002283a8a57ebab8e0bf1cc8e/diff:/var/lib/docker/overlay2/7f5fbcaacf206ec2d4f2809fc0810fe7f757ef09a11f39e15c4c9f8ddaf24324/diff",
                "MergedDir": "/var/lib/docker/overlay2/7b68455a3154e16a766784819e39c5c5286bb79c29a0283561a1c83d8bc9109c/merged",
                "UpperDir": "/var/lib/docker/overlay2/7b68455a3154e16a766784819e39c5c5286bb79c29a0283561a1c83d8bc9109c/diff",
                "WorkDir": "/var/lib/docker/overlay2/7b68455a3154e16a766784819e39c5c5286bb79c29a0283561a1c83d8bc9109c/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/tmp/executor-delete-64dfa5229e6439a2c5f2/src",
                "Destination": "/tmp",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/tmp/executor-delete-64dfa5229e6439a2c5f2/builds",
                "Destination": "/usr/code",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "64f41a33ad645",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "3000/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "SMTP_PASSWORD=adsomeKEY3wtbkekwy",
                "APPWRITE_FUNCTION_RUNTIME_VERSION=2.17",
                "INERNAL_EXECUTOR_HOSTNAME=executor",
                "SMTP_PORT=587",
                "SMTP_HOST=smtp.gmail.com",
                "APPWRITE_FUNCTION_PROJECT_ID=delete",
                "RECIVER_EMAIL=ssomeReciver@gmail.com",
                "APPWRITE_FUNCTION_ID=dump",
                "APPWRITE_FUNCTION_NAME=dump",
                "APPWRITE_FUNCTION_RUNTIME_NAME=Dart",
                "SMTP_USERNAME=someuser@mail.net",
                "asdf=",
                "APPWRITE_FUNCTION_DEPLOYMENT=64dfa5229e6439a2c5f2",
                "INTERNAL_RUNTIME_KEY=4b1d7a92954883e1e9bac2bbd8c2ffd4",
                "INTERNAL_RUNTIME_ENTRYPOINT=lib/main.dart",
                "PATH=/usr/lib/dart/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "DART_SDK=/usr/lib/dart",
                "OPEN_RUNTIMES_ENTRYPOINT=lib/main.dart"
            ],
            "Cmd": [
                "sh",
                "-c",
                "cp /tmp/code.tar.gz /mnt/code/code.tar.gz \u0026\u0026 nohup helpers/start.sh \"src/function/server\""
            ],
            "Image": "openruntimes/dart:v3-2.17",
            "Volumes": null,
            "WorkingDir": "/usr/code",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "maintainer": "team@appwrite.io",
                "openruntimes-executor": "executor",
                "openruntimes-runtime-id": "delete-64dfa5229e6439a2c5f2",
                "utopia-created": "1693719091",
                "utopia-type": "runtime"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "7dd2101bc0ce2d1e5f556b3f48837c5b657cc078c71279ad4239bc0f3fe73b79",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/7dd2101bc0ce",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "runtimes": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "f9452024db1d",
                        "64f41a33ad645"
                    ],
                    "NetworkID": "9e76125a5f20b82e1fe3ef5880bde75d14a0ae013acd7c3ccb3021866e903e32",
                    "EndpointID": "",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "",
                    "DriverOpts": null
                }
            }
        }
    }
]

Checking the docker logs for the container shows:

image

which is odd because that helpers/start.sh is a v3 operation and not a v2 one.

It's also odd the docker image is a v3 image rather than v2.

🎲 Appwrite version

Version 1.3.x

💻 Operating system

MacOS

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingproduct / functionsFixes and upgrades for the Appwrite Functions.

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions