azure-functions-core-tools: "Function not implemented" error on Mac M1, works on Ubuntu
Hey team,
I’m currently stuck in the “Function not implemented” error which blocks me from using my Mac. How to reproduce:
- Follow https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local to create a nodejs function, add
"start": "func start"
into package.json - Create a Dockerfile to use ubuntu:bionic image and install depedencies
FROM --platform=linux/amd64 ubuntu:bionic
RUN apt update && \
apt install -y \
apt-transport-https \
curl \
lsb-release gnupg \
virtualenv && \
curl -sL https://packages.microsoft.com/keys/microsoft.asc | \
gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.asc.gpg && \
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | \
apt-key add && \
echo \
"deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" \
> /etc/apt/sources.list.d/azure-cli.list && \
echo \
"deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" \
> /etc/apt/sources.list.d/dotnetdev.list && \
echo "deb https://deb.nodesource.com/node_10.x disco main" \
> /etc/apt/sources.list.d/nodesource.list && \
apt update && \
apt install -y \
azure-cli \
azure-functions-core-tools \
libicu-dev \
build-essential \
nodejs \
unzip \
zip && \
useradd -m azure && \
chown -R azure:azure /home/azure/.bashrc && \
mkdir -p /root/.azure-functions-core-tools/Functions/ExtensionBundles && \
cd /root/.azure-functions-core-tools/Functions/ExtensionBundles && \
curl -O https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/2.4.0/Microsoft.Azure.Functions.ExtensionBundle.2.4.0.zip && \
mkdir -p Microsoft.Azure.Functions.ExtensionBundle/2.4.0 && \
unzip Microsoft.Azure.Functions.ExtensionBundle.2.4.0.zip -d Microsoft.Azure.Functions.ExtensionBundle/2.4.0 && \
cd -
USER azure
- Create a docker-compose.yaml file
version: "3.7"
services:
demo:
container_name: demo
build:
context: .
dockerfile: ./Dockerfile
user: root
working_dir: /work
ports:
- "7071:7071"
volumes:
- ./MyFunctionProj:/work
command: sh -c "ls -lrt && npm start -- -p 7071 --cors-credentials --cors 'http://localhost:7070'"
networks:
default:
driver: bridge
driver_opts:
com.docker.network.driver.mtu: 1400
- Start the docker in Ubuntu environment and Mac M1 environment
Thank you.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 14
- Comments: 51 (6 by maintainers)
I was facing the same issue on my Mac M1. I have managed to resolve it by doing the following
You can follow detailed steps and explanation here http://issamben.com/running-azure-function-as-docker-container-on-an-m1-m2/
@anthonychu @stefanushinardi Can you please provide an update for ETA on developing Azure Functions on an M1 chip in docker? Is this a Docker issue or an Azure Functions issue?
Here’s my workaround to create an env that Azure will tolerate on Apple Silicon…
Workaround on Apple Silicon
1. Installing Rosetta
softwareupdate --install-rosetta --agree-to-license
~/Applications/
and duplicate ‘Terminal’You have now created a second terminal application that will always run as x64_86. Test this by entering
arch
, it should show asi386
as opposed toarm64
. You can always enterpython -c "import platform;print(platform.machine())"
to test that the Python interpreter is running on Rosetta.2. Installing Dependencies
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> /Users/USERNAME/.zprofile
andeval "$(/usr/local/bin/brew shellenv)"
after brew installCONDA_SUBDIR=osx-64 conda create -n rosetta python=3.9
conda activate rosetta
arch -x86_64 brew tap azure/functions
thenarch -x86_64 brew install azure-functions-core-tools@4
arch -x86_64 brew update && arch -x86_64 brew install azure-cli
az login
to authenticate in browser.pip install -r requirements.txt
3. Testing that all is A-OK
func start host
localhost:7071...
Ocp-Apim-Subscription-Key
Locally the functions work fine. The issue is when running in a container.
Any updates on this issue ? I am experiencing the same difficulties on an M1 chip.
Thanks @wangcarlton. @diberry just reported the same issue. Looks like maybe one of the OS APIs used by the filewatcher isn’t implemented when running in a
linux/amd64
container when running on an M1 docker host.Really, 1 Year and 8 Months since the issue is opened and still there? Is this the way for MS to say they don’t care for Devs on Macs?
Similar issues when launching the devcontainer Azure Functions template: Azure Functions & PowerShell on M1 MacBook Pro.
Devcontainer.json
Also tried with
mcr.microsoft.com/azure-functions/powershell:4-powershell7.2
which gives a similar error:Facing the same issue, any updates on this?
For whomever may get here later, besides upgrading docker and enable rosetta in docker, you may also consider upgrading Mac OS version, which has been helpful for me, as without it docker may not even show the enable rosetta button.
Good heavens! Lost 2 hours trying to resolve this until I stumbled across this thread! It worked - thank you so much!
Hey everybody,
Anybody who has trouble starting the Azure Function via console should check if your Azure Functions Core Tool is compatible with your .NET Core version. For example Azure Functions Core Tool 3.1 did not work for me with .NET Core 6.x .
Azure Functions runtime versions overview: https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=in-process%2Cv4&pivots=programming-language-csharp
But I am facing a simialar same problem on a Docker image (built from MacBook Air with M1-Chip). I set up an Azure Function with Azure Functions Core Tools (4.0.3971).
func init --docker
(dotnet)func new
(BlobTrigger)The function is running inside Visual Studio and from the console (.Net Core 6.0.3 installed). But when I build my docker image with the following command:
docker build --platform linux/arm64/v8 -t someimagename
and if I try to run it:
docker run -it someimagename
I get the following error:
Same error if I do not specifiy the platform building the docker image.
Here is my Dockerfile:
I switched over using these images and that seems to work fine. Hopefully official support for arm64 drops soon. https://github.com/Azure/azure-functions-docker/issues/487#issuecomment-1236274099
I encountered the same issue running a simple ASP.NET app on M1 macOS.
I was able to resolve it by adding an environment variable to disable automatic config reload. Not sure if it would apply to Azure Functions as well, but it looks like the same call stack.
Same issue here on Apple M1 with the following dockerfile