Skip to content

ember serve is currently broken — Cannot read property 'replace' of undefined  #7870

Closed

Description

@chrism

ember serve no longer works with the most recent version of Canary.

It can be reproduced as simply as by creating a new application and upgrading ember-cli to the latest version.

ember new classic-error --yarn
yarn upgrade ember-cli@https://github.com/ember-cli/ember-cli.git

Now it displays this error when running ember serve

Here is the full stack from the error log file

  - stack: TypeError: Cannot read property 'replace' of undefined
    at Class.serverMiddleware (/Users/username/classic-error/node_modules/ember-cli-inject-live-reload/index.js:44:38)
    at ExpressServerTask.<anonymous> (/Users/username/classic-error/node_modules/ember-cli/lib/tasks/server/express-server.js:101:22)
    at /Users/username/classic-error/node_modules/promise-map-series/index.js:11:14
    at tryCatch (/Users/username/classic-error/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/Users/username/classic-error/node_modules/rsvp/dist/rsvp.js:538:13)
    at publish (/Users/username/classic-error/node_modules/rsvp/dist/rsvp.js:508:7)
    at flush (/Users/username/classic-error/node_modules/rsvp/dist/rsvp.js:2415:5)
    at process._tickCallback (internal/process/next_tick.js:112:11)

The line it refers to is this one.

var baseURLWithoutHost = baseURL.replace(/^https?:\/\/[^\/]+/, '');

I noticed that the most recent commit to ember-cli also related to config and baseURL so figured perhaps this was the cause.

By downgrading the ember-cli package to the previous commit SHA

yarn upgrade ember-cli@https://github.com/ember-cli/ember-cli.git#5f78c5c2e88b5d701798ec7b09bf3e636ef0fbb2

ember serve now runs the server again correctly.

This makes me pretty confident that the issue has arisen from the most recent commit.


Output from ember version --verbose && npm --version && yarn --version:

ember-cli: 3.2.0-beta.2
http_parser: 2.7.0
node: 9.8.0
v8: 6.2.414.46-node.21
uv: 1.19.2
zlib: 1.2.11
ares: 1.13.0
modules: 59
nghttp2: 1.29.0
napi: 2
openssl: 1.0.2n
icu: 60.2
unicode: 10.0
cldr: 32.0.1
tz: 2017c
os: darwin x64
5.6.0
1.6.0

Activity

  1. rwjblue commented on Jun 9, 2018

    @rwjblue
    Member
  2. buschtoens commented on Jun 10, 2018

    @buschtoens
    Contributor

    Also experiencing this. But only for a module unification addon. Works fine for a regular addon. 🤔

  3. buschtoens commented on Jun 10, 2018

    @buschtoens
    Contributor

    Nevermind. I did not upgrade the classic addon as described by @chrism. After upgrading, I experience the same error in a classic addon.

  4. buschtoens commented on Jun 10, 2018

    @buschtoens
    Contributor
  5. rwjblue commented on Jun 14, 2018

    @rwjblue
    Member

    Fixed by #7875

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions