Giter Club home page Giter Club logo

Comments (4)

br41nslug avatar br41nslug commented on September 26, 2024

Judging from the error the field was not created properly, can you consistently reproduce this when removing and recreating the field that errored activitiesimage?

from directus.

dellumdeus avatar dellumdeus commented on September 26, 2024

Yes, I tried multiple times with no luck. I now restarted my server and now directus cannot find any image (they are connected with Azure Blob Storage.

I has this error for every image:

2024-05-23T12:38:45.053136472Z: [INFO]  [12:38:44.707] ERROR: select top (@p0) [directus_files].[id], [directus_files].[storage], [directus_files].[filename_disk], [directus_files].[filename_download], [directus_files].[title], [directus_files].[type], [directus_files].[folder], [directus_files].[uploaded_by], [directus_files].[uploaded_on], [directus_files].[modified_by], [directus_files].[modified_on], [directus_files].[charset], [directus_files].[filesize], [directus_files].[width], [directus_files].[height], [directus_files].[duration], [directus_files].[embed], [directus_files].[description], [directus_files].[location], [directus_files].[tags], [directus_files].[metadata], [directus_files].[focal_point_x], [directus_files].[focal_point_y], [directus_files].[CinemaPage] from [directus_files] where [directus_files].[id] = @p1 order by [directus_files].[id] asc - Invalid column name 'CinemaPage'.
2024-05-23T12:38:45.053141472Z: [INFO]      err: {
2024-05-23T12:38:45.053144772Z: [INFO]        "type": "RequestError",
2024-05-23T12:38:45.053148172Z: [INFO]        "message": "select top (@p0) [directus_files].[id], [directus_files].[storage], [directus_files].[filename_disk], [directus_files].[filename_download], [directus_files].[title], [directus_files].[type], [directus_files].[folder], [directus_files].[uploaded_by], [directus_files].[uploaded_on], [directus_files].[modified_by], [directus_files].[modified_on], [directus_files].[charset], [directus_files].[filesize], [directus_files].[width], [directus_files].[height], [directus_files].[duration], [directus_files].[embed], [directus_files].[description], [directus_files].[location], [directus_files].[tags], [directus_files].[metadata], [directus_files].[focal_point_x], [directus_files].[focal_point_y], [directus_files].[CinemaPage] from [directus_files] where [directus_files].[id] = @p1 order by [directus_files].[id] asc - Invalid column name 'CinemaPage'.",
2024-05-23T12:38:45.053152972Z: [INFO]        "stack":
2024-05-23T12:38:45.053156672Z: [INFO]            Error: select top (@p0) [directus_files].[id], [directus_files].[storage], [directus_files].[filename_disk], [directus_files].[filename_download], [directus_files].[title], [directus_files].[type], [directus_files].[folder], [directus_files].[uploaded_by], [directus_files].[uploaded_on], [directus_files].[modified_by], [directus_files].[modified_on], [directus_files].[charset], [directus_files].[filesize], [directus_files].[width], [directus_files].[height], [directus_files].[duration], [directus_files].[embed], [directus_files].[description], [directus_files].[location], [directus_files].[tags], [directus_files].[metadata], [directus_files].[focal_point_x], [directus_files].[focal_point_y], [directus_files].[CinemaPage] from [directus_files] where [directus_files].[id] = @p1 order by [directus_files].[id] asc - Invalid column name 'CinemaPage'.
2024-05-23T12:38:45.053165573Z: [INFO]                at RequestTokenHandler.onErrorMessage (/directus/node_modules/.pnpm/[email protected]/node_modules/tedious/lib/token/handler.js:287:21)
2024-05-23T12:38:45.053169373Z: [INFO]                at Readable.<anonymous> (/directus/node_modules/.pnpm/[email protected]/node_modules/tedious/lib/token/token-stream-parser.js:18:33)
2024-05-23T12:38:45.053172973Z: [INFO]                at Readable.emit (node:events:517:28)
2024-05-23T12:38:45.053176173Z: [INFO]                at addChunk (node:internal/streams/readable:368:12)
2024-05-23T12:38:45.053179473Z: [INFO]                at readableAddChunk (node:internal/streams/readable:341:9)
2024-05-23T12:38:45.053182773Z: [INFO]                at Readable.push (node:internal/streams/readable:278:10)
2024-05-23T12:38:45.053186073Z: [INFO]                at next (node:internal/streams/from:98:31)
2024-05-23T12:38:45.053189373Z: [INFO]                at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-05-23T12:38:45.053192773Z: [INFO]        "code": "EREQUEST",
2024-05-23T12:38:45.053196073Z: [INFO]        "number": 207,
2024-05-23T12:38:45.053217073Z: [INFO]        "state": 1,
2024-05-23T12:38:45.053220573Z: [INFO]        "class": 16,
2024-05-23T12:38:45.053223973Z: [INFO]        "serverName": "my-directus-server-mssql",
2024-05-23T12:38:45.053227373Z: [INFO]        "procName": "",
2024-05-23T12:38:45.053230773Z: [INFO]        "lineNumber": 1
2024-05-23T12:38:45.053234173Z: [INFO]      }

For me it looks like directus is trying to access the column CinemaPage (the name of my singleton) on the directus_files table, where it for sure doesn't exist [directus_files].[CinemaPage]:

image

from directus.

rijkvanzanten avatar rijkvanzanten commented on September 26, 2024

Heya! This is an issue specific to Azure / MS SQL. In MS SQL, you can't have multiple foreign key constraints to the same collection at the same time. Directus by default tries to nullify the related foreign key on deletion of a file, but that causes this issue when you create a second m2o field (like an image) to the same collection.

You might find an error like

Error: Introducing FOREIGN KEY constraint 'singleton_activitiesimage_foreign' on table 'singleton' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.

in the logs indicating the same thing. There is a workaround though! If you go to the relationship while configuring the field, and set the "On Delete of directus_files..." option to "Prevent the deletion", it'll work as expected.

CleanShot 2024-07-11 at 16 33 17@2x

We've gotten the same bug report in multiple flavors, so I'll close this in favor of making 1 pinned issue that covers this issue and the workaround 🙂

from directus.

rijkvanzanten avatar rijkvanzanten commented on September 26, 2024

Superseded by: #22990

from directus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.