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

Trivial port send example: Uncaught TypeError: Cannot read property 'tag' of undefined #822

Closed
maca opened this Issue Jan 24, 2017 · 5 comments

Comments

Projects
None yet
6 participants
@maca

maca commented Jan 24, 2017

I am getting this runtime error for the most trivial port send example:

JS:

elmApp.ports.incoming.send("hello")
// #=> Uncaught TypeError: Cannot read property 'tag' of undefined

Elm:

port module Ports exposing (..)

port incoming : (String -> msg)  -> Sub msg

Using: elm 0.18
Browser/OS: Chromium 55/Linux

Gist coming...

@process-bot

This comment has been minimized.

Show comment
Hide comment
@process-bot

process-bot Jan 24, 2017

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot commented Jan 24, 2017

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@maca maca changed the title from Trivial port example: Uncaught TypeError: Cannot read property 'tag' of undefined to Trivial port send example: Uncaught TypeError: Cannot read property 'tag' of undefined Jan 24, 2017

@maca

This comment has been minimized.

Show comment
Hide comment
@maca

maca Jan 24, 2017

It works fine when I define my main module as a port module and define the ports there, instead of doing it in another file/module.

Feel free to disregard

maca commented Jan 24, 2017

It works fine when I define my main module as a port module and define the ports there, instead of doing it in another file/module.

Feel free to disregard

@aaronjameslang

This comment has been minimized.

Show comment
Hide comment
@aaronjameslang

aaronjameslang Aug 25, 2017

This still occurs, specifically if the project's port module has a name beginning with a letter before J, and does not have a declared dependency on Json.Decode then the elm compiler will emit the port module code before Json.Decode which causes all decoders to be Undefined. See https://groups.google.com/forum/#!topic/elm-discuss/Zs5LFb_Ei_4

Edit: Canonical issue appears to be https://github.com/elm-lang/core/issues/703

aaronjameslang commented Aug 25, 2017

This still occurs, specifically if the project's port module has a name beginning with a letter before J, and does not have a declared dependency on Json.Decode then the elm compiler will emit the port module code before Json.Decode which causes all decoders to be Undefined. See https://groups.google.com/forum/#!topic/elm-discuss/Zs5LFb_Ei_4

Edit: Canonical issue appears to be https://github.com/elm-lang/core/issues/703

@FranzSkuffka

This comment has been minimized.

Show comment
Hide comment
@FranzSkuffka

FranzSkuffka May 25, 2018

For me this also occurs. Please Re-Open.

FranzSkuffka commented May 25, 2018

For me this also occurs. Please Re-Open.

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz May 25, 2018

Member

Please make an http://sscce.org/ and open a new issue.

Member

evancz commented May 25, 2018

Please make an http://sscce.org/ and open a new issue.

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