Erro com Oracle Fila - Funciona no MySql
[Concluído]
Professor, pode me ajudar?.
Acredito que o campo do oracle é clob, e quando a payload ele vai executar a fila, ele dá esse erro por não converter os dados.
Quando faço a inserção do meu arquivo excel diretamente sem a fila, popula normalmente, portanto quando executo com fila, dá esse erro, mas eu testei via mysql e funciona.
Ajuda por favor, haha.🤯 🤯 🤯 🤯
Tentei alterar o campo para um varchar2 que suporta até 4k caracteres, portanto o payload ultrapassar, chegando a 5241 caracteres.
local.ERROR: Array to string conversion {"exception":"[object] (ErrorException(code: 0): Array to string conversion at C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Stringable.php:32)
Quando eu importo sem a fila, popula no banco normalmente:
Olá, Jean!
Tudo bem?
Teria o projeto no GitHub?
Opa professor, boa tarde!
Obrigado, segue o repos.
https://github.com/jeanasilva/gt_back
Testei em mysql e funciona, mas no oracle, realmente eu não sei qual o problema, pois ele salva na tabela de JOB portanto ele fica dando erro no log do laravel ao tentar executar a queewe:work, ele não retorna nada e nem envia para a tabela failed_jobs.
https://github.com/jeanasilva/gt_back
Qual é o log do erro?
[2022-12-16 13:57:02] local.ERROR: Array to string conversion {"exception":"[object] (ErrorException(code: 0): Array to string conversion at C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Stringable.php:32)
[stacktrace]
#0 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\HandleExceptions.php(259): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'Array to string...', 'C:\\\\laragon\\\\www\\\\...', 32)
#1 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Stringable.php(32): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}(2, 'Array to string...', 'C:\\\\laragon\\\\www\\\\...', 32)
#2 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Str.php(68): Illuminate\\Support\\Stringable->__construct(Array)
#3 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\DatabaseQueue.php(261): Illuminate\\Support\\Str::of(Array)
#4 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\DatabaseQueue.php(239): Illuminate\\Queue\\DatabaseQueue->getLockForPopping()
#5 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\DatabaseQueue.php(224): Illuminate\\Queue\\DatabaseQueue->getNextAvailableJob('default')
#6 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Concerns\\ManagesTransactions.php(30): Illuminate\\Queue\\DatabaseQueue->Illuminate\\Queue\\{closure}(Object(Yajra\\Oci8\\Oci8Connection))
#7 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\DatabaseQueue.php(227): Illuminate\\Database\\Connection->transaction(Object(Closure))
#8 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Worker.php(342): Illuminate\\Queue\\DatabaseQueue->pop('default')
#9 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Worker.php(351): Illuminate\\Queue\\Worker->Illuminate\\Queue\\{closure}('default')
#10 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Worker.php(160): Illuminate\\Queue\\Worker->getNextJob(Object(Illuminate\\Queue\\DatabaseQueue), 'default')
#11 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Console\\WorkCommand.php(146): Illuminate\\Queue\\Worker->daemon('database', 'default', Object(Illuminate\\Queue\\WorkerOptions))
#12 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Console\\WorkCommand.php(130): Illuminate\\Queue\\Console\\WorkCommand->runWorker('database', 'default')
#13 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#14 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#15 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#16 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#17 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(651): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#18 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(182): Illuminate\\Container\\Container->call(Array)
#19 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\symfony\\console\\Command\\Command.php(312): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#20 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(152): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#21 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\symfony\\console\\Application.php(1020): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#22 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\symfony\\console\\Application.php(312): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Queue\\Console\\WorkCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#23 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\symfony\\console\\Application.php(168): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#24 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Application.php(102): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#25 C:\\laragon\\www\\Back-end\\gateway-web-backend\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(155): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#26 C:\\laragon\\www\\Back-end\\gateway-web-backend\\artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#27 {main}
"}
As colunas estão idênticas, tanto no MySQL, quanto no Oracle?
--
Você pode converter o array, usando a função json_encode, isso vai converter o array para string, e com isso vai parar de dar erro no seu banco de dados.
Olá professor, tudo bem?. Boa noite!
Ja tentei implode, json_encode, tentei serielizar e fazer o inverso, mas mesmo assim no Oracle ele pede para fazer a conversão, por algum motivo os valores que estão serializados no comando payload da fila, não funcionam com o Oracle, acredito que seja devido o campo ser clob, os campos são identifico, mudei a biblioteca, mas o problema não é no Excel e sim na fila quando tentar passar o payload com os dados no campo clob do Oracle para a tabela upload_files.
Você está controlando as filas (queues) com banco de dados?
Por que não usa o redis? Além de ser mais rápido, não terá mais este problema.
Olá professor,
Eu preciso informar ao usuário quando finalizar a transação. E também tive problemas com redis.
Quais foram os problemas com o redis?
--
Está armazenando as filas no banco?
QUEUE_CONNECTION=database
Olá Professor, boa noite!
Obrigado pela ajuda, eu acabei utilizando o Redis mesmo, tive que criar um outro servidor no docker.
Precisa estar logado para conseguir responder a este ticket!
Clique Aqui Para Entrar!