Static files not being moved where expected or redirect isn't working on build preview

NextJS site, using latest netlify build plugin. My deploy previews are linking to urls like

https://deploy-preview-420--resistbot-website-ed6e4f.netlify.app/_next/static/css/162060b5ee1a3a55.css

but that file is a 404. Downloading the build result shows that the static dir is not under _next but is a peer to it. Here’s the expected file at the path that reflects the build assets I dowloaded:

https://deploy-preview-420--resistbot-website-ed6e4f.netlify.app/static/css/162060b5ee1a3a55.css

Based on this redirect that is added, it would seem this is ok, but why is that URL not redirecting to the file that exists?

{ from: '/_next/static/*', to: '/static/:splat', status: 200 },

This doesn’t seem to be affecting our production deploys but I’m too afraid to deploy any new code to find out. It affects any and all deploy previews for at least the last few days, maybe a bit longer.

Screenshot 2022-03-09 at 08.49.10@2x

Relevant links and info

Netlify App
resistbot-website-ed6e4f

netlify.toml
# https://docs.netlify.com/configure-builds/file-based-configuration/
[build]
  # Note: This *requires* setting the base directory in the UI to `packages/site`
  command = "yarn build"
  publish = ".next"

[build.environment]
  NETLIFY_USE_YARN = "true"
  ACTIVE_ENV = "staging"
  NODE_ENV = "production"
  YARN_FLAGS = "--production=false"
  PYTHON_VERSION = "3.8"
  RUBY_VERSION = "2.7.2"

# https://docs.netlify.com/configure-builds/file-based-configuration/#functions
[functions]
  node_bundler = "esbuild"

# Can expand this for other things, including site url
# https://docs.netlify.com/configure-builds/environment-variables/
# https://docs.netlify.com/configure-builds/file-based-configuration/
[context.production]
  environment = { ACTIVE_ENV = "production"}

# Stripe CSP: https://stripe.com/docs/security/guide#content-security-policy
[[headers]]
  for = "*"
  [headers.values]
    X-Frame-Options = "DENY"
    X-Content-Type-Options = "nosniff"
    Referrer-Policy = "strict-origin-when-cross-origin"
    Permissions-Policy = "microphone=(),geolocation=(),interest-cohort=()"
    Content-Security-Policy = '''
    default-src 'self';
    base-uri 'none';
    child-src 'self' blob:;
    form-action 'self';
    font-src 'self' data:;
    frame-ancestors 'none';
    object-src 'none';
    worker-src 'self' blob:;
    img-src 'self' blob: data: https://ziggy-stardust-welcome.resist.bot https://cdn.sanity.io;
    script-src 'self' 'unsafe-inline' https://ziggy-stardust-welcome.resist.bot https://js.stripe.com https://platform.twitter.com;
    style-src 'self' 'unsafe-inline';
    connect-src 'self' https://api.stripe.com https://api.mapbox.com https://events.mapbox.com https://platform.twitter.com https://*.sentry.io https://o70939.ingest.sentry.io https://resistbot.report-uri.com https://cdn.sanity.io https://fj76bufg96.execute-api.us-west-2.amazonaws.com https://8qidifgfmb.execute-api.us-west-2.amazonaws.com;
    frame-src https://js.stripe.com https://hooks.stripe.com https://platform.twitter.com;
    report-uri https://resistbot.report-uri.com/r/d/csp/enforce;
    report-to default;
    '''
    Report-To = '{"group":"default","max_age":86400,"endpoints":[{"url":"https://resistbot.report-uri.com/a/d/g"}],"include_subdomains":true}'
    NEL = '{"report_to":"default","max_age":86400,"include_subdomains":true}'

[[plugins]]
  package = "@netlify/plugin-nextjs"

[[plugins]]
  package = "netlify-plugin-submit-sitemap"

  [plugins.inputs]
  baseUrl = "https://resist.bot"
  sitemapPath = "/sitemap.xml"
  providers = [
    "google",
    "bing",
  ]

[[plugins]]
  package = "@sentry/netlify-build-plugin"

  [plugins.inputs]
    sentryOrg = "redacted"
    sentryProject = "redacted"

[[plugins]]
  package = "/plugins/netlify-honeycomb-deploy-notifier"

  [plugins.inputs]
    honeycombDatasetName = "redacted"
    honeycombDatasetNamePreview = "redacted"
    deployPreviews = true

# This page only lived a short while, can probably be deleted after 2021.
# Many trending tweet posts used this format
[[redirects]]
  from = "/petitions/trending"
  to = "/petitions"
  status = 301
  force = true

# Temporary page for the podcast
[[redirects]]
  from = "/podcasts/live"
  to = "https://resistbot.live"
  status = 302
  force = true

Secondarily, seeing this in my builds but I have no idea what it means or where it’s coming from:

9:05:57 AM: Incorrect TOML configuration format: 
parse error on value ["2022", "03", "08", nil, nil, nil, nil] (DATETIME)
9:05:57 AM: Skipping HTML post processing
9:05:57 AM: Incorrect TOML configuration format: 
parse error on value ["2022", "03", "08", nil, nil, nil, nil] (DATETIME)
9:05:57 AM: Incorrect TOML configuration format: 
parse error on value ["2022", "03", "08", nil, nil, nil, nil] (DATETIME)
9:05:57 AM: Post processing - header rules
9:05:58 AM: Incorrect TOML configuration format: 
parse error on value ["2022", "03", "08", nil, nil, nil, nil] (DATETIME)
9:05:58 AM: Post processing - redirect rules
9:05:58 AM: Incorrect TOML configuration format: 
parse error on value ["2022", "03", "08", nil, nil, nil, nil] (DATETIME)

hi there, just letting you know we haven’t forgotten about you! we hope to have more information for you soon.

Hey @embarrassment-setup,

I checked this deploy: Netlify App

and it turns out, your TOML file is being modified in a weird way that’s not allowing it to be parsed correctly. Thus, no redirect rules are actually being deployed (as indicated above the deploy log). Do you know if you’re modifying your TOML file apart from the Next.js plugin?

1 Like

Quite sure I’m not doing that intentionally, no.

Hey @embarrassment-setup,

In that case, would you be able to create a separate site with the same repo, except you remove all the plugins except for the Next.js plugin to see if it works? If it’s caused by some plugin, this would fix it and if not, you might be using an incorrect TOML file from the start - which is unlikely as we check that almost at the initial stages of the build, but still worth a check.

I forget how this played out but pretty sure it was an issue with the Netlify/Next build plugin.