Skip to content

Upload new file in existing import #137

Description

@SteJW

Bug description

The imports are being used to manage product stock. With a CSV (delimiter ;) we can upload a file every week to update the promotion labels on the website.
Now with statamic 6 and the newest import, it's not possible to upload a new file and save.

How to reproduce

  1. Create a new import with a CSV file.
  2. Connect to entries, update items, delimiter ;
  3. save & continue
  4. The page refreshes, you can map the fields
  5. save again and you're done.

Now the update

  1. Upload a new file.
  2. The fields where you can map the csv are removed.
  3. Usually you save first and then the field mapping options show, but not this time. You can't save because of the validation. It looks for an unique field and mappings, but you can't select the mapping fields are not showing.
  4. refreshing the page won't help, because it will return to the old upload file.

Logs

{
    "message": "The given data was invalid.",
    "errors": {
        "mappings": [
            "This field is required."
        ],
        "unique_field": [
            "This field is required when Data Type is entries."
        ]
    }
}

Environment

Laravel Version: 13.18.1
PHP Version: 8.4.8
Composer Version: 2.8.9
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: null
Cache: file
Database: mysql
Logs: stack / single, nightwatch
Mail: smtp
Queue: sync
Session: file

Storage
public/assets: LINKED
public/storage: LINKED
public/xml: NOT LINKED

Statamic
Addons: 32
License Key: Not set
Sites: 2 (Dutch, English)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 6.23.0 PRO

Statamic Addons
aerni/font-awesome: 4.0.1
doefom/statamic-export: 0.7.0
jacksleight/statamic-bard-texstyle: 4.1.1
rias/statamic-redirect: 4.1.10
statamic/eloquent-driver: 5.10.0
statamic/importer: 2.1.0
steetshub/statamic-forms-gdpr: 1.0.2
thoughtco/statamic-cache-tracker: 2.4.0
visuellverstehen/statamic-picturesque: 2.2.0

Statamic Eloquent Driver
Addon Settings: file
Asset Containers: eloquent
Assets: eloquent
Blueprints: eloquent
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Fieldsets: file
Form Submissions: eloquent
Forms: eloquent
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: file
Sites: eloquent
Taxonomies: eloquent
Terms: eloquent
Tokens: eloquent

Additional details

Request URL https://vdu-statamic.loc/cp/utilities/importer/prijzen
Request Method PATCH
Status Code 422 Unprocessable Content

{"name":"Prijzen","file":["1783422947/20260707 vw voorraadactie.csv"],"destination":{"type":"entries","collection":["models"],"blueprint":"model","site":["nl"]},"strategy":["create","update"],"source":{"csv_delimiter":";"},"_run":false}

If I change Imports/Blueprint.php:284
and remove line 'file' => 'contains '.basename($import->get('path')),
The validation is gone, the field mappings stays. I have to refresh the page though, because the columns of my CSV are not showing yet. That happens after a refresh. This is not a fix, but it shows kind of the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions