Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async netlifyToml function returns empty netlify.toml file #28

Open
Aztriltus opened this issue Jun 14, 2021 · 3 comments
Open

async netlifyToml function returns empty netlify.toml file #28

Aztriltus opened this issue Jun 14, 2021 · 3 comments

Comments

@Aztriltus
Copy link

When using netlifyToml as a normal function in nuxt.config.js as so:

export default {
  // ...
  netlifyFiles: {
    copyExistingFiles: false,
    netlifyToml() {
      return {
        redirects: [{ from: '/test', to: '/test-1', status: 301}]
      }
    }
  }
}

The module returns a correct netlify.toml file after yarn generate

[[redirects]]
from = "test"
to = "test-1"
status = 301

But when using an async function as so:

// Just an example
function redirects() {
  return new Promise(resolve => {
    resolve({
      redirects: [
        {
          from: "test",
          to: "test-1",
          status: 301
        }
      ]
    });
  });
}

export default {
  // ...
  netlifyFiles: {
    copyExistingFiles: false,
    async netlifyToml() {
      return await redirects();
    }
  }
}

A netlify.toml will be generated in /dist, but the content is blank.

Any idea?

@bootsmann1995
Copy link

@Aztriltus did you manage to fix this?

@Aztriltus
Copy link
Author

Hey @bootsmann1995 I didn't manage to. I've used another way of redirecting now

@wiven
Copy link

wiven commented Dec 20, 2021

I'm running into the same issue. When using an async function the object is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants