Skip to content

Styles not getting passed to Amp Toolbox after Next update to 9.5 #15979

@ghankerson

Description

@ghankerson

Bug report

Looks like styles may not be passed to apmtoolbox after updating to 9.5

Describe the bug

Error thrown
TypeError: Cannot read property 'data' of undefined

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
ApplyCommonAttributes.applyToCustomStyles
file:///Users/ghankerson/code/mprnews/node_modules/@ampproject/toolbox-optimizer/lib/transformers/ApplyCommonAttributes.js (261:26)
ServerSideRendering.transform
file:///Users/ghankerson/code/mprnews/node_modules/@ampproject/toolbox-optimizer/lib/transformers/ServerSideRendering.js (142:27)
sequence
file:///Users/ghankerson/code/mprnews/node_modules/@ampproject/toolbox-optimizer/lib/DomTransformer.js (143:26)
process._tickCallback
internal/process/next_tick.js (68:7)
A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

See https://github.com/APMG/mprnews/blob/master/pages/amp/story/%5B...slug%5D.js
and
https://github.com/APMG/mprnews/blob/master/endpoints/AmpStory/AmpStory.js

and especially how we do amp styes: https://github.com/APMG/mprnews/blob/master/components/AmpContent/AmpContentHeader.js#L7

Expected behavior

A rendered Amp page

Screenshots

Screen Shot 2020-08-07 at 12 40 22 PM

## System information
  • OS: MacOS, CentOs
  • Browser Any (ssr)
  • Version of Next.js
  • Version of Node.js: v10.17.0 (also 12 on our servers)

Additional context

This worked fined under 9.4.4 and other recent versions before 9.5 . Do I need to add something to my webpack config ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions