Is there a way to enqueue a request without actual...
# crawlee-js
f
What I’m trying to do is leverage Crawlee’s request queue + uniqueKey de-duplication, but I don’t want to hit a real URL. Conceptually, I just want to “switch routes” (change the label) and trigger another operation/state in the crawler, while still using the queue’s uniqueness guarantees. Is this possible, or is a real URL always required when adding a request? Currently getting
Copy code
Reclaiming failed request back to the list or queue. Expected `RequestOptions.url` to be of type `string` but received type `undefined`
I want something like that
Copy code
import { v4 as uuidv4 } from 'uuid';

const itemRequests: Partial<Source>[] = dataResults.map((result) => {
    const itemKey = result.item.key; // generic key
    return {
        uniqueKey: request.userData.saveOnlyUniqueItems ? itemKey : uuidv4(),
        label: labels.SPECIFIC_ITEM, // generic label
        userData: {
            ...request.userData,
            itemData: result.item, // pass the data generically
        },
    };
});
a
message has been deleted
w
Yes, one can use the [
skipNavigation
option on the request](https://crawlee.dev/js/docs/examples/skip-navigation)
a
message has been deleted
f
Alright, thank you! It is worth noting that you still need to provide a URL else it will throw an error even though you skip the navigation
w
Yeah, if I remember correctly it already throws the error when you try to construct the request object/enqueue the request
2 Views