Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERNAL_SERVER_ERROR importing SVGs from a url or localhost with Supabase #22168

Closed
sangrepura opened this issue Apr 11, 2024 · 1 comment · Fixed by #22293
Closed

INTERNAL_SERVER_ERROR importing SVGs from a url or localhost with Supabase #22168

sangrepura opened this issue Apr 11, 2024 · 1 comment · Fixed by #22293

Comments

@sangrepura
Copy link

Describe the Bug

Directus Version: 10.10.5
Postgres Version: 16.3

In the Directus UI

{
  "errors": [
    {
      "message": {
        "length": 145,
        "name": "error",
        "severity": "ERROR",
        "code": "22P02",
        "where": "unnamed portal parameter $7 = '...'",
        "file": "numutils.c",
        "line": "879",
        "routine": "pg_strtoint64_safe"
      },
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR"
      }
    }
  ]
}

In the server logs

[04:07:37.859] ERROR: update "directus_files" set "storage" = $1, "filename_disk" = $2, "filename_download" = $3, "title" = $4, "type" = $5, "folder" = $6, "filesize" = $7, "description" = $8, "metadata" = $9, "modified_by" = $10, "modified_on" = $11 where "id" in ($12) - invalid input syntax for type bigint: "NaN"
    err: {
      "type": "DatabaseError",
      "message": "update \"directus_files\" set \"storage\" = $1, \"filename_disk\" = $2, \"filename_download\" = $3, \"title\" = $4, \"type\" = $5, \"folder\" = $6, \"filesize\" = $7, \"description\" = $8, \"metadata\" = $9, \"modified_by\" = $10, \"modified_on\" = $11 where \"id\" in ($12) - invalid input syntax for type bigint: \"NaN\"",
      "stack":
          error: update "directus_files" set "storage" = $1, "filename_disk" = $2, "filename_download" = $3, "title" = $4, "type" = $5, "folder" = $6, "filesize" = $7, "description" = $8, "metadata" = $9, "modified_by" = $10, "modified_on" = $11 where "id" in ($12) - invalid input syntax for type bigint: "NaN"
              at Parser.parseErrorMessage (/directus/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/dist/parser.js:283:98)
              at Parser.handlePacket (/directus/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/dist/parser.js:122:29)
              at Parser.parse (/directus/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/dist/parser.js:35:38)
              at Socket.<anonymous> (/directus/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/dist/index.js:11:42)
              at Socket.emit (node:events:517:28)
              at addChunk (node:internal/streams/readable:368:12)
              at readableAddChunk (node:internal/streams/readable:341:9)
              at Readable.push (node:internal/streams/readable:278:10)
              at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
      "length": 145,
      "name": "error",
      "severity": "ERROR",
      "code": "22P02",
      "where": "unnamed portal parameter $7 = '...'",
      "file": "numutils.c",
      "line": "879",
      "routine": "pg_strtoint64_safe"
    }

An entry gets created in the DB, none of the values that were null are non-nullable:

"id"	"storage"	"filename_disk"	"filename_download"	"title"	"type"	"folder"	"uploaded_by"	"uploaded_on"	"modified_by"	"modified_on"	"charset"	"filesize"	"width"	"height"	"duration"	"embed"	"description"	"location"	"tags"	"metadata"	"focal_point_x"	"focal_point_y"

"35a67f1b-d401-4300-a503-b8e583186f2a"	"supabase"	"35a67f1b-d401-4300-a503-b8e583186f2a.svg"	"Vue.js_Logo_2.svg"	"Vue Logo"	"image/svg+xml"	"8cddc78f-7c57-4b11-bb8b-5ffa9130f04a"	"38130c74-963c-4091-905b-a227606ba603"	"2024-04-09 09:37:18.373207+00"	"38130c74-963c-4091-905b-a227606ba603"	"2024-04-11 02:55:53.798+00"		

The files show up like this in the UI

Screenshot 2024-04-10 232657

This is a fresh install of the latest Directus 10.10.5 I would really appreciate it if someone could maybe give me some clues why it's broken.

To Reproduce

Install Directus on Docker
Connect it to a PostgresSQL database
Use Supabase for image storage
Use Redis for cache
Upload an SVG

Directus Version

v10.10.5

Hosting Strategy

Self-Hosted (Docker Image)

@sangrepura
Copy link
Author

Here's my ENV settings for reference:

      # General
      PUBLIC_URL: "https://***.***.***"
      MAX_PAYLOAD_SIZE: "30mb"
      # Database
      DB_CLIENT: "pg"
      DB_PORT: "5432"
      DB_HOST: "***"
      DB_DATABASE: "***"
      DB_USER: "***"
      DB_PASSWORD: "***"
      # Redis
      REDIS_ENABLED: "true"
      REDIS_HOST: "***"
      REDIS_PORT: "6379"
      REDIS_USERNAME: ""
      REDIS_PASSWORD: "***"
      # Security
      KEY: "***"
      SECRET: "***"
      # CORS
      CORS_ENABLED: "true"
      CORS_ORIGIN: "*"
      # Cache
      CACHE_ENABLED: "true"
      CACHE_STORE: "redis"
      CACHE_AUTO_PURGE: "true"
      CACHE_REDIS_TLS__CA: "base64cert"
      CACHE_REDIS_TLS__REJECT_UNAUTHORIZED: "false"
      # File Storage
      STORAGE_LOCATIONS: "supabase"
      STORAGE_SUPABASE_DRIVER: "supabase"
      STORAGE_SUPABASE_SERVICE_ROLE: "***"
      STORAGE_SUPABASE_PROJECT_ID: "***"
      STORAGE_SUPABASE_BUCKET: "directus"
      # Synchronization
      SYNCHRONIZATION_STORE: "redis"
      # Email
      EMAIL_FROM: "no-reply@***.***"
      EMAIL_TRANSPORT: "smtp"
      # SMTP (smtp)
      EMAIL_SMTP_HOST: "smtp.resend.com"
      EMAIL_SMTP_PORT: "2587"
      EMAIL_SMTP_SECURE: "false"
      EMAIL_SMTP_USER: "resend"
      EMAIL_SMTP_IGNORE_TLS: "false"
      EMAIL_SMTP_NAME: ***
      EMAIL_SMTP_PASSWORD: "***"
      # Admin Account
      ADMIN_EMAIL: "***@***.***"
      ADMIN_PASSWORD: "***"
      # WebSockets
      WEBSOCKETS_ENABLED: "true"

@paescuj paescuj changed the title INTERNAL_SERVER_ERROR importing SVGs from a url or localhost INTERNAL_SERVER_ERROR importing SVGs from a url or localhost with Supabase Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant