Drupal 8.4.3 included a patch for #2916300 Use ComputedFieldItemListTrait for the path field type. The specific patch is ccc4d9ceaa214c05d189258ed4ab5d9f86d4c758.

With this fix applied, nodes created via REST POST do not generate automatic URL aliases.

My configuration:

- In Admin > Structure > Content Type, we have a content type "event"
- In Admin > Config > Search and Metadata > URL Aliases, we have a pattern for Type = Content and "The node bundle is events". The pattern is "/event/[node-title]"
- We have REST POST configured to allow node creation for type "event"

The problem:

When an event node is created via REST, we expect the alias to be auto-generated as "/event/[node-title]", instead, it is "/node/[nid]" which is the default path.

When an event node is created manually, the generate automatic URL alias works correctly.

When I revert the fix for #2916300 by running `patch -p1 -R < that.patch`, nodes created via REST then correctly auto-generate the expected URL aliases.

I hope this is sufficient information!

Comments

karenann created an issue. See original summary.

Houmanvg’s picture

Status: Active » Needs review

I am experiencing the exact same issue. But with JSON API module. I am on D8.4.4

That is:

When a node is created via JSON API module, the pathauto does not generate the URL alias, but instead it is /node/[nid].

When a node is created manually thru the GUI, the pathauto works correctly.

This problem started occurring when I updated recently.

Karenann have you found a solution yet?

marral’s picture

Hello
I got the same issue and i just added a "path" : ["TRUE"] to my post body request and it works well now.
try this maybe it's gonna work for you.

Houmanvg’s picture

So the issue is that path auto is not set to TRUE, when a node is created by the API modules (Json API, or REST).

Btw, the workaround #3 works.

Berdir’s picture

Status: Needs review » Postponed (maintainer needs more info)

There were various reports since 8.4 about strange effects. Only found time now to start looking into it. Can you check if #2945734: Fix automated test failures in 8.x-1.x is fixing this for you?

If not, a failing test would be helpful.

karenann’s picture

I suspect that this issue will be resolved when I update to 8.x-1.2. I'm fairly sure that the fix is https://www.drupal.org/project/pathauto/issues/2950701. I have this on my calendar to test in May 2018.