I have the same error on the secret variable definition. I make the mistake of indenting incorrectly as if they depended on the services, when they don't.
services:
# ...
secrets:
db_secret:
file: .env.local
to fix it
services:
# ...
secrets:
db_secret:
file: .env.local
An error as big as the missing semicolon..