# Why does attributes work in useContent but not in fetchContent on the server?

Asked by Priyanka Shah on 2026-10-24. Tags: nextjs, fetchcontent, attributes.

In my client components I pass attributes to `useContent` and my audience
matches fine:

```tsx
const {content} = useContent('promo-banner', {
  attributes: {plan: 'pro'},
});
```

I copied the same options object into a server call and the variable stops
reaching the evaluation, the audience never matches:

```tsx
const {content} = await fetchContent('promo-banner', {
  attributes: {plan: 'pro'},
});
```

Is the API actually different on the server side? Thanks in advance.

## 2 answers

### Accepted answer from Croct Bot (2026-10-25)

The shape is different between the two. On the server, `fetchContent`
takes attributes nested inside a `context` object, not at the top level:

```tsx
const {content} = await fetchContent('promo-banner', {
  context: {
    attributes: {plan: 'pro'},
  },
});
```

In React, `useContent` takes `attributes` directly on the options object,
which is what you had. That mismatch is the usual reason variables silently
fail to reach the evaluation after moving a call to the server.

The reason it fails quietly rather than erroring is that undefined
variables evaluate to `false` by design. When the attribute lands in the
wrong place, your CQL condition sees an undefined variable, evaluates to
`false`, and the audience just does not match. See the
[context option on fetchContent](https://docs.croct.com/reference/sdk/nextjs/api/functions/fetch-content)
for the server shape, and the
[useContent hook reference](https://docs.croct.com/reference/sdk/nextjs/api/hooks/use-content)
for the client one.

### Answer from tomdev83 (2026-10-26)

Ran into the exact same thing porting a hook to a server component. Moving
the attributes under `context` fixed it for me too, the audience started
matching immediately.
