# Troubleshooting Composer Dump-Autoload Issues in Sage 10 Deployment

**URL:** https://discourse.roots.io/t/troubleshooting-composer-dump-autoload-issues-in-sage-10-deployment/26085
**Category:** sage
**Tags:** composer, sage10
**Created:** 2023-10-09T09:16:07Z
**Posts:** 6

## Post 1 by @kemari_klaas — 2023-10-09T09:16:07Z

Hi everybody,

Currently we are working on a project running on sage 10. When deploying to one of our servers, we are getting Undefined variable error messages. We’ve tried to find the issue, if we run composer dump-autoload, the issue seems to be solved. But each time we deploy, the error comes back again. It looks like the variables inside of our composers are not getting created.

We are making use of the `Roots\Acorn\ComposerScripts::postAutoloadDump`, and the correct markup for our composer (protected static $views and public function with). Does anyone have experience with this problem and knows how to fix it?

Regards,  
Klaas

---

## Post 2 by @igor_sumonja — 2023-10-09T10:51:00Z

did you add this in Acorn ?

We also recommend adding Acorn’s `postAutoloadDump` function to Composer’s `post-autoload-dump` event in the `scripts` section of `composer.json`:

```
"scripts": {
  //...
  "post-autoload-dump": [
    "Roots\\Acorn\\ComposerScripts::postAutoloadDump"
  ]
}
```

---

## Post 3 by @kemari_klaas — 2023-10-09T11:28:15Z

Hi Igor,

Yes, correct.

---

## Post 4 by @alwaysblank — 2023-10-09T14:47:03Z

What is your deploy process?

---

## Post 5 by @kemari_klaas — 2023-10-09T16:49:48Z

```
- step:
                      name: Install Composer dependencies
                      image: composer:2.5
                      caches:
                        - composer
                      artifacts:
                        - vendor/**
                      script:
                        - composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts --classmap-authoritative

                  - step:
                        name: Build yarn
                        image: node:18.15.0
                        caches:
                            - node
                        script:
                            - yarn
                            - yarn build
                        artifacts:
                            - public/**
```

After that, it makes an rsync call to the server. I’ve already tried changing the composer script to `- composer install --no-dev` with no success.

---

## Post 6 by @ben — 2023-10-09T17:16:30Z

Try adding `wp acorn optimize` as a step in your deployment process
