2

I'm developing an app that uses Lighthouse GraphQL server for Laravel. It's generally great, but I've run into some weird behaviour.

When I run it locally, using Laravel Valet, it works perfectly. When I run it on staging server, it fails with Call to undefined relationship [venue] on model [App\\Event]. Event has one Venue and Venue can have many events.

When I use tinker on the server, it finds relationships fine.

Relationship on Event is setup like this

public function venue() : BelongsTo
{
    return $this->belongsTo('App\Venue');
}

And relationship on Venue is

 public function events() : HasMany
{
    return $this->hasMany('App\Event', 'venue_id');
}

In schema.graphql relationship is defined as

 type Event {
    id: ID!
    [...]
    venue: Venue @belongsTo
}

And other relationships work fine. Same versions locally and on staging.

Any idea as to what is going on?

Michael Sørensen
  • 395
  • 1
  • 3
  • 14

1 Answers1

0

Answering my own question here. It turned out to be a difference in Laravel version that apparently caused the problem. A minor version at that.

Fixed the problem by locking the version for now and getting back to it in next release.

Michael Sørensen
  • 395
  • 1
  • 3
  • 14